Created
May 8, 2014 08:51
-
-
Save Anticom/e99f87698d26cbfe7403 to your computer and use it in GitHub Desktop.
NoFlo counting component
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
noflo = require 'noflo' | |
class CoffeeCounter extends noflo.Component | |
description: 'This is my test description.' | |
icon: 'gear' | |
constructor: -> | |
@current = 0 | |
@inPorts = | |
up: new noflo.Port 'bang' | |
down: new noflo.Port 'bang' | |
reset: new noflo.Port 'bang' | |
@outPorts = | |
out: new noflo.Port 'bang' | |
@inPorts.up.on 'data', => | |
@current++; | |
@outPorts.out.send @current | |
@inPorts.down.on 'data', => | |
@current--; | |
@outPorts.out.send @current | |
@inPorts.reset.on 'data', => | |
@current = 0; | |
@outPorts.out.send @current | |
exports.getComponent = -> new CoffeeCounter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment