Created
April 1, 2016 10:49
-
-
Save trustmaster/e2ec8ccb23c9d9a3e6a429121522abad to your computer and use it in GitHub Desktop.
Substreams and scalar example
This file contains hidden or 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
c = new noflo.Component | |
inPorts: | |
streamy: | |
datatype: 'object' | |
description: 'Substreams' | |
inty: | |
datatype: 'int' | |
description: 'Scalar' | |
outPorts: | |
result: | |
datatype: 'object' | |
c.process (input, output) -> | |
if input.has 'streamy' | |
s = input.get 'streamy' | |
switch s.type | |
when 'openBracket' | |
c.streamy = [ s.data ] | |
c.streamyComplete = false | |
when 'data' | |
c.streamy.push s.data | |
when 'closeBracket' | |
c.streamyComplete = true | |
if input.has 'inty' and c.streamyComplete | |
i = input.getData 'inty' | |
res = doSomething c.streamy, i | |
c.streamyComplete = false | |
output.sendDone | |
result: res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment