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

compile fixes

This commit is contained in:
Kyle Spearrin 2019-08-13 11:40:54 -04:00
parent 58a73bcb0f
commit 384f3f1e47
2 changed files with 8 additions and 6 deletions

View File

@ -1,3 +1,5 @@
import { SafariApp } from './safariApp';
export class BrowserApi {
static isWebExtensionsApi: boolean = (typeof browser !== 'undefined');
static isSafariApi: boolean = (window as any).safariAppExtension === true;
@ -222,7 +224,7 @@ export class BrowserApi {
} else if (BrowserApi.isWebExtensionsApi || BrowserApi.isChromeApi) {
win.close();
} else if (BrowserApi.isSafariApi && safari.extension.popovers && safari.extension.popovers.length > 0) {
BrowserApi.sendSafariMessageToApp({ command: 'hideWindow' });
SafariApp.sendMessageToApp('hideWindow');
}
}
@ -286,7 +288,7 @@ export class BrowserApi {
if (win != null) {
return win.location.reload(true);
} else if (BrowserApi.isSafariApi) {
BrowserApi.sendSafariMessageToApp({ command: 'reloadWindow' });
SafariApp.sendMessageToApp('reloadWindow');
} else if (!BrowserApi.isSafariApi) {
return chrome.runtime.reload();
}

View File

@ -1,14 +1,14 @@
import { BrowserApi } from '../browser/browserApi';
import { SafariApp } from '../browser/safariApp';
import { MessagingService } from 'jslib/abstractions';
import { MessagingService } from 'jslib/abstractions/messaging.service';
export default class BrowserMessagingService implements MessagingService {
send(subscriber: string, arg: any = {}) {
const message = Object.assign({}, { command: subscriber }, arg);
if (BrowserApi.isSafariApi) {
BrowserApi.sendSafariMessageToApp(message);
SafariApp.sendMessageToApp(subscriber, arg);
} else {
const message = Object.assign({}, { command: subscriber }, arg);
chrome.runtime.sendMessage(message);
}
}