diff options
author | Frankie <frankie.pangilinan@consensys.net> | 2016-08-11 04:48:34 +0800 |
---|---|---|
committer | Frankie <frankie.pangilinan@consensys.net> | 2016-08-11 04:48:34 +0800 |
commit | ba1edc429b948962fe0f03ef43588f7945cea3f2 (patch) | |
tree | eda1b54a424c2fc06ef151763b5cb57d2e838116 /app/scripts/lib/extension-instance.js | |
parent | 9c6dd9ef4953f6e421feb6e6684ef43da26f6b75 (diff) | |
parent | c48b60d7a6f14d2d2348be8d9a63965ca1267433 (diff) | |
download | tangerine-wallet-browser-ba1edc429b948962fe0f03ef43588f7945cea3f2.tar tangerine-wallet-browser-ba1edc429b948962fe0f03ef43588f7945cea3f2.tar.gz tangerine-wallet-browser-ba1edc429b948962fe0f03ef43588f7945cea3f2.tar.bz2 tangerine-wallet-browser-ba1edc429b948962fe0f03ef43588f7945cea3f2.tar.lz tangerine-wallet-browser-ba1edc429b948962fe0f03ef43588f7945cea3f2.tar.xz tangerine-wallet-browser-ba1edc429b948962fe0f03ef43588f7945cea3f2.tar.zst tangerine-wallet-browser-ba1edc429b948962fe0f03ef43588f7945cea3f2.zip |
Merge branch 'master' into buyForm
Diffstat (limited to 'app/scripts/lib/extension-instance.js')
-rw-r--r-- | app/scripts/lib/extension-instance.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/app/scripts/lib/extension-instance.js b/app/scripts/lib/extension-instance.js new file mode 100644 index 000000000..eb3b8a1e9 --- /dev/null +++ b/app/scripts/lib/extension-instance.js @@ -0,0 +1,51 @@ +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 { + _this.api = browser.extension[api] + } catch (e) {} + + }) +} + +module.exports = Extension |