From 418951021f1f14a560637586facfec40bb70e5e0 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 14 Aug 2018 21:29:32 -0400 Subject: [PATCH] add browser typing to global def --- src/browser/browserApi.ts | 8 ++++---- src/globals.d.ts | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/browser/browserApi.ts b/src/browser/browserApi.ts index 2683581852..6f4a0e293d 100644 --- a/src/browser/browserApi.ts +++ b/src/browser/browserApi.ts @@ -3,8 +3,8 @@ export class BrowserApi { static isSafariApi: boolean = (typeof safari !== 'undefined') && navigator.userAgent.indexOf(' Safari/') !== -1 && navigator.userAgent.indexOf('Chrome') === -1; static isChromeApi: boolean = !BrowserApi.isSafariApi && (typeof chrome !== 'undefined'); - static isFirefoxOnAndroid: boolean = - navigator.userAgent.indexOf('Firefox/') !== -1 && navigator.userAgent.indexOf('Android') !== -1; + static isFirefoxOnAndroid: boolean = navigator.userAgent.indexOf('Firefox/') !== -1 && + navigator.userAgent.indexOf('Android') !== -1; static async getTabFromCurrentWindowId(): Promise { if (BrowserApi.isChromeApi) { @@ -210,8 +210,8 @@ export class BrowserApi { // COMPAT: Reactivating the active tab dismisses the popout-tab. The promise final // condition is only called if the popout wasn't already dismissed (future proofing). // BUGZILLA: https://bugzilla.mozilla.org/show_bug.cgi?id=1433604 - browser.tabs.update({active: true}).finally(win.close); - } else if (browserApi.isWebExtensionsApi || BrowserApi.isChromeApi) { + browser.tabs.update({ active: true }).finally(win.close); + }  else if (browserApi.isWebExtensionsApi || BrowserApi.isChromeApi) { win.close(); } else if (BrowserApi.isSafariApi && safari.extension.popovers && safari.extension.popovers.length > 0) { safari.extension.popovers[0].hide(); diff --git a/src/globals.d.ts b/src/globals.d.ts index 61c847c5da..2868ff5ae7 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -2,4 +2,5 @@ declare function escape(s: string): string; declare function unescape(s: string): string; declare var opr: any; declare var chrome: any; +declare var browser: any; declare var safari: any;