diff options
author | frankiebee <frankie.diamond@gmail.com> | 2017-03-24 02:06:38 +0800 |
---|---|---|
committer | frankiebee <frankie.diamond@gmail.com> | 2017-03-24 02:06:38 +0800 |
commit | 45ab81fb45ec1043d617f66c308e2e7911c8e0ad (patch) | |
tree | 335c7abdb8491b39184f07c9426ae30792546385 /library/sw-core.js | |
parent | d4e8ff188bc82a974fd0a767c2676d4a4b9747b4 (diff) | |
download | tangerine-wallet-browser-45ab81fb45ec1043d617f66c308e2e7911c8e0ad.tar tangerine-wallet-browser-45ab81fb45ec1043d617f66c308e2e7911c8e0ad.tar.gz tangerine-wallet-browser-45ab81fb45ec1043d617f66c308e2e7911c8e0ad.tar.bz2 tangerine-wallet-browser-45ab81fb45ec1043d617f66c308e2e7911c8e0ad.tar.lz tangerine-wallet-browser-45ab81fb45ec1043d617f66c308e2e7911c8e0ad.tar.xz tangerine-wallet-browser-45ab81fb45ec1043d617f66c308e2e7911c8e0ad.tar.zst tangerine-wallet-browser-45ab81fb45ec1043d617f66c308e2e7911c8e0ad.zip |
WIP: streams->indexdb
Diffstat (limited to 'library/sw-core.js')
-rw-r--r-- | library/sw-core.js | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/library/sw-core.js b/library/sw-core.js index 41fce637f..9ceaf1dc5 100644 --- a/library/sw-core.js +++ b/library/sw-core.js @@ -25,6 +25,10 @@ const STORAGE_KEY = 'metamask-config' const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG' let popupIsOpen = false +const log = require('loglevel') +global.log = log +log.setDefaultLevel(METAMASK_DEBUG ? 'debug' : 'warn') + self.addEventListener('install', function(event) { event.waitUntil(self.skipWaiting()) }) @@ -132,12 +136,16 @@ function setupController (initState, client) { global.metamaskController = controller // setup state persistence - pipe( - controller.store, - storeTransform(versionifyData), - diskStore - ) - + // pipe( + // controller.store, + // storeTransform(versionifyData), + // diskStore + // ) + controller.store.subscribe((store) => { + dbController.put('dataStore', store) + // .then((event) => {debugger}) + // .catch((err) => {debugger}) + }) function versionifyData(state) { let versionedData = diskStore.getState() versionedData.data = state @@ -150,10 +158,8 @@ function setupController (initState, client) { /* need to write a service worker stream for this */ - // var connectionStream = new ParentStream() connectionListener.on('remote', (portStream, messageEvent) => { - debugger - connectRemote(connectionStream, messageEvent.origin) + connectRemote(portStream, messageEvent.origin) }) function connectRemote (connectionStream, originDomain) { |