mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
bug - fix event emitter mem leak warning
This commit is contained in:
parent
9bd55f4897
commit
0a5ae39509
@ -42,16 +42,21 @@ function setupStreams () {
|
|||||||
name: 'contentscript',
|
name: 'contentscript',
|
||||||
target: 'inpage',
|
target: 'inpage',
|
||||||
})
|
})
|
||||||
pageStream.on('error', console.error)
|
|
||||||
const pluginPort = extension.runtime.connect({ name: 'contentscript' })
|
const pluginPort = extension.runtime.connect({ name: 'contentscript' })
|
||||||
const pluginStream = new PortStream(pluginPort)
|
const pluginStream = new PortStream(pluginPort)
|
||||||
pluginStream.on('error', console.error)
|
|
||||||
|
|
||||||
// forward communication plugin->inpage
|
// forward communication plugin->inpage
|
||||||
pageStream.pipe(pluginStream).pipe(pageStream)
|
pump(
|
||||||
|
pageStream,
|
||||||
|
pluginStream,
|
||||||
|
pageStream,
|
||||||
|
(err) => logStreamDisconnectWarning('MetaMask Contentscript Forwarding', err)
|
||||||
|
)
|
||||||
|
|
||||||
// setup local multistream channels
|
// setup local multistream channels
|
||||||
const mux = new ObjectMultiplex()
|
const mux = new ObjectMultiplex()
|
||||||
|
mux.setMaxListeners(25)
|
||||||
|
|
||||||
pump(
|
pump(
|
||||||
mux,
|
mux,
|
||||||
pageStream,
|
pageStream,
|
||||||
|
Loading…
Reference in New Issue
Block a user