add browser typing to global def

This commit is contained in:
Kyle Spearrin 2018-08-14 21:29:32 -04:00
parent 2d6107fae1
commit 418951021f
2 changed files with 5 additions and 4 deletions

View File

@ -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<any> {
if (BrowserApi.isChromeApi) {

1
src/globals.d.ts vendored
View File

@ -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;