git ssb

0+

wanderer🌟 / js-primea-hypervisor



Tree: 9bb00a66c6590ce780568e10d649be74c66ce1e6

Files: 9bb00a66c6590ce780568e10d649be74c66ce1e6 / port.js

353 bytesRaw
1const EventEmitter = require('events')
2
3module.exports = class Port extends EventEmitter {
4 constructor () {
5 super()
6 }
7
8 connect (destPort) {
9 this.destPort = destPort
10 destPort.destPort = this
11 }
12
13 async send (message) {
14 return this.destPort.recieve(message)
15 }
16
17 async recieve (message) {
18 this.emit('message', message)
19 }
20}
21

Built with git-ssb-web