Created
March 28, 2022 07:25
-
-
Save tobiu/47943cd1766f4a6b9f0252b2b840f7d5 to your computer and use it in GitHub Desktop.
Neo.worker.ServiceBase
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
class ServiceBase extends Base { | |
// .. | |
/** | |
* @param {Client} client | |
*/ | |
createMessageChannel(client) { | |
let me = this, | |
channel = new MessageChannel(), | |
port = channel.port2; | |
channel.port1.onmessage = me.onMessage.bind(me); | |
me.sendMessage('app', {action: 'registerPort', transfer: port}, [port]); | |
me.channelPorts.push({ | |
clientId : client.id, | |
destination: 'app', | |
port : channel.port1 | |
}); | |
} | |
} | |
Neo.applyClassConfig(ServiceBase); | |
export default ServiceBase; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment