Skip to content

Commit e4094fc

Browse files
committed
using duplex streams
1 parent 5dd5243 commit e4094fc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/background-script.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ function openLocalPort(p) {
4343

4444
function connectPort(p) {
4545
//p.sender.tab.onClose(() => console.log('tab closed, should close connection'))
46-
const [fromContentScript, toContentScript] = createConnection(p)
47-
const [fromNativeScript, toNativeScript] = createNativeConnection()
46+
const contentScriptStream = createConnection(p)
47+
const nativeScriptStream = createNativeConnection()
4848

4949
pull(
50-
fromContentScript,
50+
contentScriptStream,
5151
//logger('from content to native'),
52-
toNativeScript
52+
nativeScriptStream
5353
)
5454
pull(
55-
fromNativeScript,
55+
nativeScriptStream,
5656
//logger('from native to content'),
57-
toContentScript
57+
contentScriptStream
5858
)
5959
}
6060

@@ -98,5 +98,5 @@ function createConnection(port) {
9898
})
9999
}
100100

101-
return [fromPort, toPort]
101+
return {source: fromPort, sink: toPort}
102102
}

0 commit comments

Comments
 (0)