1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-07 09:31:31 +01:00

safariapp apis updates

This commit is contained in:
Kyle Spearrin 2019-08-15 14:06:59 -04:00
parent e5e04b8fa9
commit 039f09e33f
2 changed files with 7 additions and 3 deletions

View File

@ -156,7 +156,7 @@ export class BrowserApi {
return chrome.runtime.getManifest().version;
} else if (BrowserApi.isSafariApi) {
// TODO
return 'TODO';
return null;
} else {
return null;
}

View File

@ -3,8 +3,11 @@ import { BrowserApi } from './browserApi';
export class SafariApp {
static init() {
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));
};
}
}
@ -19,6 +22,7 @@ export class SafariApp {
id: messageId,
command: command,
data: data,
responseData: null,
}));
SafariApp.requests.set(messageId, { resolve: resolve, date: now });
});
@ -31,6 +35,6 @@ export class SafariApp {
return;
}
const p = SafariApp.requests.get(message.id);
p.resolve(message.data);
p.resolve(message.responseData);
}
}