mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Make Popup close after approving a transaction
This commit is contained in:
parent
f81fdbc34f
commit
12065a10aa
@ -1,28 +1,35 @@
|
||||
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 SWcontroller = require('client-sw-ready-event/lib/sw-client.js')
|
||||
const SwStream = require('sw-stream/lib/sw-stream.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
|
||||
|
||||
console.log('outside:open')
|
||||
|
||||
const background = new SWcontroller({
|
||||
fileName: '/popup/sw-build.js',
|
||||
})
|
||||
|
||||
// Setup listener for when the service worker is read
|
||||
background.on('ready', (readSw) => {
|
||||
let swStream = SwStream({
|
||||
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()
|
||||
})
|
||||
})
|
||||
startPopup(swStream)
|
||||
})
|
||||
|
||||
background.startWorker()
|
||||
|
Loading…
Reference in New Issue
Block a user