1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-27 12:56:01 +01:00
metamask-extension/app/scripts/lib/extension-instance.js

69 lines
1.0 KiB
JavaScript
Raw Normal View History

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) {
2016-07-26 02:47:14 +02:00
_this[api] = null
try {
if (chrome[api]) {
_this[api] = chrome[api]
}
} catch (e) {}
try {
if (window[api]) {
_this[api] = window[api]
}
} catch (e) {}
2016-08-17 01:46:44 +02:00
try {
if (browser[api]) {
_this[api] = browser[api]
}
} catch (e) {}
2016-07-26 02:47:14 +02:00
try {
_this.api = browser.extension[api]
} catch (e) {}
})
2016-08-30 02:33:18 +02:00
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