General cleanup and window reload if an update is found

feature/default_network_editable
frankiebee 8 years ago
parent 53537824f1
commit 36bafbaebf
  1. 12
      mascara/README.md
  2. 3
      mascara/src/background.js
  3. 1
      mascara/src/proxy.js
  4. 13
      mascara/src/ui.js

@ -10,3 +10,15 @@ npm run mascara
- go back to http://localhost:9002 - go back to http://localhost:9002
- open devTools - open devTools
- click Sync Tx - click Sync Tx
## Tests:
```
npm run testMascara
```
Test will run in browser, you will have to have these browsers installed:
- Chrome
- Firefox
- Opera

@ -7,7 +7,7 @@ const connectionListener = new SwGlobalListener(self)
const setupMultiplex = require('../../app/scripts/lib/stream-utils.js').setupMultiplex const setupMultiplex = require('../../app/scripts/lib/stream-utils.js').setupMultiplex
const PortStream = require('../../app/scripts/lib/port-stream.js') const PortStream = require('../../app/scripts/lib/port-stream.js')
const DbController = require('./lib/index-db-controller') const DbController = require('idb-global')
const SwPlatform = require('../../app/scripts/platforms/sw') const SwPlatform = require('../../app/scripts/platforms/sw')
const MetamaskController = require('../../app/scripts/metamask-controller') const MetamaskController = require('../../app/scripts/metamask-controller')
@ -47,7 +47,6 @@ console.log('inside:open')
let diskStore let diskStore
const dbController = new DbController({ const dbController = new DbController({
key: STORAGE_KEY, key: STORAGE_KEY,
version: 2,
}) })
loadStateFromPersistence() loadStateFromPersistence()
.then((initState) => setupController(initState)) .then((initState) => setupController(initState))

@ -20,6 +20,7 @@ background.on('ready', (_) => {
pageStream.pipe(swStream).pipe(pageStream) pageStream.pipe(swStream).pipe(pageStream)
}) })
background.on('updatefound', () => window.location.reload())
background.on('error', console.error) background.on('error', console.error)
background.startWorker() background.startWorker()

@ -46,15 +46,8 @@ background.on('ready', (sw) => {
background.removeListener('updatefound', connectApp) background.removeListener('updatefound', connectApp)
connectApp(sw) connectApp(sw)
}) })
background.on('updatefound', () => background.serviceWorkerApi.ready background.on('updatefound', () => window.location.reload())
.then((sw) =>{
background.removeListener('ready', connectApp) background.startWorker()
connectApp(sw.active)
})
)
background.on('message', (messageEvent) => {
console.log(messageEvent)
})
window.addEventListener('load', () => background.startWorker())
// background.startWorker() // background.startWorker()
console.log('hello from MetaMascara ui!') console.log('hello from MetaMascara ui!')

Loading…
Cancel
Save