Last active
December 22, 2019 19:01
-
-
Save deepal/cf2c08d35c4f39b5e2f858e634381703 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const kPublicPort = Symbol('kPublicPort'); | |
// ...redacted... | |
const { port1, port2 } = new MessageChannel(); | |
this[kPublicPort] = port1; | |
this[kPublicPort].on('message', (message) => this.emit('message', message)); | |
// ...redacted... | |
this[kPort].postMessage({ | |
type: 'loadScript', | |
filename, | |
doEval: !!options.eval, | |
cwdCounter: cwdCounter || workerIo.sharedCwdCounter, | |
workerData: options.workerData, | |
publicPort: port2, | |
// ...redacted... | |
hasStdin: !!options.stdin | |
}, [port2]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment