aboutsummaryrefslogtreecommitdiffstats
path: root/mascara/src/popup.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-04-05 02:27:45 +0800
committerGitHub <noreply@github.com>2017-04-05 02:27:45 +0800
commit5d967eeebb9f3cf4c2d3fcfe0b74cf6e8440c3cb (patch)
tree38c3fac654c41df24f01b6de3aa453d68b259c07 /mascara/src/popup.js
parent39181ed33f1b9829f82c44d2f21e2f3ab1d1c979 (diff)
parent4779999bfc7e03eedf3fd2702f7f448d751218f8 (diff)
downloadtangerine-wallet-browser-5d967eeebb9f3cf4c2d3fcfe0b74cf6e8440c3cb.tar
tangerine-wallet-browser-5d967eeebb9f3cf4c2d3fcfe0b74cf6e8440c3cb.tar.gz
tangerine-wallet-browser-5d967eeebb9f3cf4c2d3fcfe0b74cf6e8440c3cb.tar.bz2
tangerine-wallet-browser-5d967eeebb9f3cf4c2d3fcfe0b74cf6e8440c3cb.tar.lz
tangerine-wallet-browser-5d967eeebb9f3cf4c2d3fcfe0b74cf6e8440c3cb.tar.xz
tangerine-wallet-browser-5d967eeebb9f3cf4c2d3fcfe0b74cf6e8440c3cb.tar.zst
tangerine-wallet-browser-5d967eeebb9f3cf4c2d3fcfe0b74cf6e8440c3cb.zip
Merge pull request #1307 from MetaMask/mascara
Proof of Concept: Mascara
Diffstat (limited to 'mascara/src/popup.js')
-rw-r--r--mascara/src/popup.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/mascara/src/popup.js b/mascara/src/popup.js
new file mode 100644
index 000000000..ef7759a81
--- /dev/null
+++ b/mascara/src/popup.js
@@ -0,0 +1,36 @@
+const injectCss = require('inject-css')
+const SWcontroller = require('client-sw-ready-event/lib/sw-client.js')
+const SwStream = require('sw-stream/lib/sw-stream.js')
+const MetaMaskUiCss = require('../../ui/css')
+const setupIframe = require('./lib/setup-iframe.js')
+const MetamaskInpageProvider = require('../../app/scripts/lib/inpage-provider.js')
+const startPopup = require('../../app/scripts/popup-core')
+
+var css = MetaMaskUiCss()
+injectCss(css)
+const container = document.getElementById('app-content')
+
+var name = 'popup'
+window.METAMASK_UI_TYPE = name
+
+const background = new SWcontroller({
+ fileName: '/popup/sw-build.js',
+})
+
+// Setup listener for when the service worker is read
+background.on('ready', (readSw) => {
+ let connectionStream = SwStream({
+ serviceWorker: background.controller,
+ context: name,
+ })
+ startPopup({container, connectionStream}, (err, store) => {
+ if (err) return displayCriticalError(err)
+ store.subscribe(() => {
+ const state = store.getState()
+ if (state.appState.shouldClose) window.close()
+ })
+ })
+})
+
+background.startWorker()
+console.log('hello from /library/popup.js')