1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

WIP:stream

This commit is contained in:
frankiebee 2017-03-21 15:35:01 -07:00
parent 60f00a950c
commit d4e8ff188b
3 changed files with 13 additions and 12 deletions

View File

@ -5,9 +5,9 @@ module.exports = class IndexDbController extends EventEmitter {
super()
this.migrations = opts.migrations
this.key = opts.key
this.dbObject = opts.global.indexedDB
this.IDBTransaction = opts.global.IDBTransaction || opts.global.webkitIDBTransaction || opts.global.msIDBTransaction || {READ_WRITE: "readwrite"}; // This line should only be needed if it is needed to support the object's constants for older browsers
this.IDBKeyRange = opts.global.IDBKeyRange || opts.global.webkitIDBKeyRange || opts.global.msIDBKeyRange;
this.dbObject = global.indexedDB
this.IDBTransaction = global.IDBTransaction || global.webkitIDBTransaction || global.msIDBTransaction || {READ_WRITE: "readwrite"}; // This line should only be needed if it is needed to support the object's constants for older browsers
this.IDBKeyRange = global.IDBKeyRange || global.webkitIDBKeyRange || global.msIDBKeyRange;
this.version = opts.version
this.logging = opts.logging
this.initialState = opts.initialState
@ -72,8 +72,7 @@ module.exports = class IndexDbController extends EventEmitter {
}
migrate () {
// Place holder for future migrations eg:
this.db.createObjectStore('dataStore')
this.db.createObjectStore(this.name)
}
_add (key, objStore, cb = logger) {

View File

@ -4,7 +4,9 @@ const urlUtil = require('url')
const endOfStream = require('end-of-stream')
const asyncQ = require('async-q')
const pipe = require('pump')
// const ParentStream = require('iframe-stream').ParentStream
const SwGlobalListener = require('sw-stream/lib/sw-global-listener.js')
const connectionListener = new SwGlobalListener(self)
const setupMultiplex = require('../app/scripts/lib/stream-utils.js').setupMultiplex
const PortStream = require('../app/scripts/lib/port-stream.js')
// const notification = require('../app/scripts/lib/notifications.js')
@ -148,12 +150,11 @@ function setupController (initState, client) {
/*
need to write a service worker stream for this
*/
var connectionStream //= new ParentStream()
SWGlobal.onmessage = (message) => {
connectRemote(connectionStream, message.origin)
}
connectRemote(connectionStream, client.origin)
// var connectionStream = new ParentStream()
connectionListener.on('remote', (portStream, messageEvent) => {
debugger
connectRemote(connectionStream, messageEvent.origin)
})
function connectRemote (connectionStream, originDomain) {
var isMetaMaskInternalProcess = (originDomain === 'http://localhost:9001')

View File

@ -104,6 +104,7 @@
"request-promise": "^4.1.1",
"sandwich-expando": "^1.0.5",
"semaphore": "^1.0.5",
"sw-stream": "^1.0.1",
"textarea-caret": "^3.0.1",
"three.js": "^0.73.2",
"through2": "^2.0.1",