UNPKG

697 Btext/coffeescriptView Raw
1noflo = require 'noflo'
2
3class DisconnectAfterPacket extends noflo.Component
4 description: 'Forwards any packets, but also sends a disconnect after each of them'
5 icon: 'pause'
6 constructor: ->
7 @inPorts = new noflo.InPorts
8 in:
9 datatype: 'all'
10 description: 'Packet to be forward with disconnection'
11 @outPorts = new noflo.OutPorts
12 out:
13 datatype: 'all'
14
15 @inPorts.in.on 'begingroup', (group) =>
16 @outPorts.out.beginGroup group
17 @inPorts.in.on 'data', (data) =>
18 @outPorts.out.send data
19 @outPorts.out.disconnect()
20 @inPorts.in.on 'endgroup', =>
21 @outPorts.out.endGroup()
22
23exports.getComponent = -> new DisconnectAfterPacket