diff options
author | kumavis <kumavis@users.noreply.github.com> | 2019-03-12 21:47:21 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-03-12 21:47:21 +0800 |
commit | 48047f81947c28cc21f0fb93fe98a2d308078714 (patch) | |
tree | fb7a60317d331fadc640149bea15a257b9dd8d06 /mascara/src/ui.js | |
parent | 70e7e592aee53c672639841f029c963331cfae81 (diff) | |
download | tangerine-wallet-browser-48047f81947c28cc21f0fb93fe98a2d308078714.tar tangerine-wallet-browser-48047f81947c28cc21f0fb93fe98a2d308078714.tar.gz tangerine-wallet-browser-48047f81947c28cc21f0fb93fe98a2d308078714.tar.bz2 tangerine-wallet-browser-48047f81947c28cc21f0fb93fe98a2d308078714.tar.lz tangerine-wallet-browser-48047f81947c28cc21f0fb93fe98a2d308078714.tar.xz tangerine-wallet-browser-48047f81947c28cc21f0fb93fe98a2d308078714.tar.zst tangerine-wallet-browser-48047f81947c28cc21f0fb93fe98a2d308078714.zip |
mascara - remove from project (#6283)
Diffstat (limited to 'mascara/src/ui.js')
-rw-r--r-- | mascara/src/ui.js | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/mascara/src/ui.js b/mascara/src/ui.js deleted file mode 100644 index f9e7670ea..000000000 --- a/mascara/src/ui.js +++ /dev/null @@ -1,73 +0,0 @@ -const injectCss = require('inject-css') -const SwController = require('sw-controller') -const SwStream = require('sw-stream') -const MetaMaskUiCss = require('../../ui/css') -const MetamascaraPlatform = require('../../app/scripts/platforms/window') -const startPopup = require('../../app/scripts/popup-core') - -// create platform global -global.platform = new MetamascaraPlatform() - -var css = MetaMaskUiCss() -injectCss(css) -const container = document.getElementById('app-content') - -const name = 'popup' -window.METAMASK_UI_TYPE = name -window.METAMASK_PLATFORM_TYPE = 'mascara' - -const keepAliveDelay = Math.floor(Math.random() * (30000 - 1000)) + 1000 - -const swController = new SwController({ - fileName: './background.js', - keepAlive: true, - keepAliveDelay, - keepAliveInterval: 20000, -}) - -swController.once('updatefound', windowReload) -swController.once('ready', async () => { - try { - swController.removeListener('updatefound', windowReload) - console.log('swController ready') - await timeout(1000) - console.log('connecting to app') - await connectApp() - console.log('app connected') - } catch (err) { - console.error(err) - } -}) - -console.log('starting service worker') -swController.startWorker() - -// Setup listener for when the service worker is read -function connectApp () { - const connectionStream = SwStream({ - serviceWorker: swController.getWorker(), - context: name, - }) - return new Promise((resolve, reject) => { - startPopup({ container, connectionStream }, (err, store) => { - console.log('hello from MetaMascara ui!') - if (err) reject(err) - store.subscribe(() => { - const state = store.getState() - if (state.appState.shouldClose) window.close() - }) - resolve() - }) - }) -} - -function windowReload () { - if (window.METAMASK_SKIP_RELOAD) return - window.location.reload() -} - -function timeout (time) { - return new Promise((resolve) => { - setTimeout(resolve, time || 1500) - }) -} |