Skip to content

Commit

Permalink
Add CreateArray component. Relates to noflo#6.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulyoung committed May 13, 2014
1 parent 52c786b commit 3dcae37
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"components/CreateDate.coffee",
"components/SetPropertyValue.coffee",
"components/CallMethod.coffee",
"components/CreateArray.coffee",
"index.js"
],
"json": [
Expand Down Expand Up @@ -76,4 +77,4 @@
"Values": "components/Values.coffee"
}
}
}
}
23 changes: 23 additions & 0 deletions components/CreateArray.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
noflo = require 'noflo'

class CreateArray extends noflo.Component
constructor: ->
@inPorts = new noflo.InPorts
start:
datatype: 'bang'
description: 'Signal to create a new array'
@outPorts = new noflo.OutPorts
out:
datatype: 'array'
description: 'A new empty array'

@inPorts.start.on 'begingroup', (group) =>
@outPorts.out.beginGroup group
@inPorts.start.on "data", =>
@outPorts.out.send []
@inPorts.start.on 'endgroup', =>
@outPorts.out.endGroup()
@inPorts.start.on 'disconnect', =>
@outPorts.out.disconnect()

exports.getComponent = -> new CreateArray

0 comments on commit 3dcae37

Please sign in to comment.