parent
5036263f88
commit
6259ffaef4
@ -1,68 +0,0 @@ |
||||
const apis = [ |
||||
'alarms', |
||||
'bookmarks', |
||||
'browserAction', |
||||
'commands', |
||||
'contextMenus', |
||||
'cookies', |
||||
'downloads', |
||||
'events', |
||||
'extension', |
||||
'extensionTypes', |
||||
'history', |
||||
'i18n', |
||||
'idle', |
||||
'notifications', |
||||
'pageAction', |
||||
'runtime', |
||||
'storage', |
||||
'tabs', |
||||
'webNavigation', |
||||
'webRequest', |
||||
'windows', |
||||
] |
||||
|
||||
function Extension () { |
||||
const _this = this |
||||
|
||||
apis.forEach(function (api) { |
||||
|
||||
_this[api] = null |
||||
|
||||
try { |
||||
if (chrome[api]) { |
||||
_this[api] = chrome[api] |
||||
} |
||||
} catch (e) {} |
||||
|
||||
try { |
||||
if (window[api]) { |
||||
_this[api] = window[api] |
||||
} |
||||
} catch (e) {} |
||||
|
||||
try { |
||||
if (browser[api]) { |
||||
_this[api] = browser[api] |
||||
} |
||||
} catch (e) {} |
||||
try { |
||||
_this.api = browser.extension[api] |
||||
} catch (e) {} |
||||
}) |
||||
|
||||
try { |
||||
if (browser && browser.runtime) { |
||||
this.runtime = browser.runtime |
||||
} |
||||
} catch (e) {} |
||||
|
||||
try { |
||||
if (browser && browser.browserAction) { |
||||
this.browserAction = browser.browserAction |
||||
} |
||||
} catch (e) {} |
||||
|
||||
} |
||||
|
||||
module.exports = Extension |
@ -1,17 +0,0 @@ |
||||
/* Extension.js |
||||
* |
||||
* A module for unifying browser differences in the WebExtension API. |
||||
* |
||||
* Initially implemented because Chrome hides all of their WebExtension API |
||||
* behind a global `chrome` variable, but we'd like to start grooming |
||||
* the code-base for cross-browser extension support. |
||||
* |
||||
* You can read more about the WebExtension API here: |
||||
* https://developer.mozilla.org/en-US/Add-ons/WebExtensions
|
||||
*/ |
||||
|
||||
const Extension = require('./extension-instance') |
||||
const instance = new Extension() |
||||
window.METAMASK_EXTENSION = instance |
||||
module.exports = instance |
||||
|
Loading…
Reference in new issue