safariapp apis updates
This commit is contained in:
parent
e5e04b8fa9
commit
039f09e33f
|
@ -156,7 +156,7 @@ export class BrowserApi {
|
||||||
return chrome.runtime.getManifest().version;
|
return chrome.runtime.getManifest().version;
|
||||||
} else if (BrowserApi.isSafariApi) {
|
} else if (BrowserApi.isSafariApi) {
|
||||||
// TODO
|
// TODO
|
||||||
return 'TODO';
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,11 @@ import { BrowserApi } from './browserApi';
|
||||||
export class SafariApp {
|
export class SafariApp {
|
||||||
static init() {
|
static init() {
|
||||||
if (BrowserApi.isSafariApi) {
|
if (BrowserApi.isSafariApi) {
|
||||||
(window as any).bitwardenSafariAppMessageReceiver = (message: any) =>
|
(window as any).bitwardenSafariAppMessageReceiver = (message: any) => {
|
||||||
|
// tslint:disable-next-line
|
||||||
|
console.log(message);
|
||||||
SafariApp.receiveMessageFromApp(message == null ? null : JSON.parse(message));
|
SafariApp.receiveMessageFromApp(message == null ? null : JSON.parse(message));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +22,7 @@ export class SafariApp {
|
||||||
id: messageId,
|
id: messageId,
|
||||||
command: command,
|
command: command,
|
||||||
data: data,
|
data: data,
|
||||||
|
responseData: null,
|
||||||
}));
|
}));
|
||||||
SafariApp.requests.set(messageId, { resolve: resolve, date: now });
|
SafariApp.requests.set(messageId, { resolve: resolve, date: now });
|
||||||
});
|
});
|
||||||
|
@ -31,6 +35,6 @@ export class SafariApp {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const p = SafariApp.requests.get(message.id);
|
const p = SafariApp.requests.get(message.id);
|
||||||
p.resolve(message.data);
|
p.resolve(message.responseData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue