noflo-core
Version:
NoFlo Essentials
52 lines (43 loc) • 1.18 kB
text/coffeescript
noflo = require 'noflo'
class RunTimeout extends noflo.Component
description: 'Send a packet after the given time in ms'
icon: 'clock-o'
constructor: ->
= null
= null
= new noflo.InPorts
time:
datatype: 'number'
description: 'Time after which a packet will be sent'
start:
datatype: 'bang'
description: 'Start the timeout before sending a packet'
clear:
datatype: 'bang'
description: 'Clear the timeout'
required: no
= new noflo.OutPorts
out:
datatype: 'bang'
.time.on 'data', () =>
.start.on 'data', =>
.clear.on 'data', =>
if
startTimer: ->
if
.out.connect()
= setTimeout =>
.out.send true
.out.disconnect()
= null
,
stopTimer: ->
return unless
clearTimeout
= null
.out.disconnect()
shutdown: ->
if
exports.getComponent = -> new RunTimeout