1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +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() super()
this.migrations = opts.migrations this.migrations = opts.migrations
this.key = opts.key this.key = opts.key
this.dbObject = opts.global.indexedDB this.dbObject = 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.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 = opts.global.IDBKeyRange || opts.global.webkitIDBKeyRange || opts.global.msIDBKeyRange; this.IDBKeyRange = global.IDBKeyRange || global.webkitIDBKeyRange || global.msIDBKeyRange;
this.version = opts.version this.version = opts.version
this.logging = opts.logging this.logging = opts.logging
this.initialState = opts.initialState this.initialState = opts.initialState
@ -72,8 +72,7 @@ module.exports = class IndexDbController extends EventEmitter {
} }
migrate () { migrate () {
// Place holder for future migrations eg: this.db.createObjectStore(this.name)
this.db.createObjectStore('dataStore')
} }
_add (key, objStore, cb = logger) { _add (key, objStore, cb = logger) {

View File

@ -4,7 +4,9 @@ const urlUtil = require('url')
const endOfStream = require('end-of-stream') const endOfStream = require('end-of-stream')
const asyncQ = require('async-q') const asyncQ = require('async-q')
const pipe = require('pump') 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 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 notification = require('../app/scripts/lib/notifications.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 need to write a service worker stream for this
*/ */
var connectionStream //= new ParentStream() // var connectionStream = new ParentStream()
SWGlobal.onmessage = (message) => { connectionListener.on('remote', (portStream, messageEvent) => {
connectRemote(connectionStream, message.origin) debugger
} connectRemote(connectionStream, messageEvent.origin)
})
connectRemote(connectionStream, client.origin)
function connectRemote (connectionStream, originDomain) { function connectRemote (connectionStream, originDomain) {
var isMetaMaskInternalProcess = (originDomain === 'http://localhost:9001') var isMetaMaskInternalProcess = (originDomain === 'http://localhost:9001')

View File

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