Skip to content
Browse files

More configurability

  • Loading branch information...
1 parent 96c6dd0 commit 8f5ecdbe67d1a7d1d136b2f3c774007f295065b8 @bergie bergie committed
Showing with 14 additions and 0 deletions.
  1. +14 −0 components/CollectObject.coffee
View
14 components/CollectObject.coffee
@@ -6,11 +6,13 @@ class CollectObject extends noflo.Component
constructor: ->
@keys = []
+ @allpackets = []
@data = {}
@groups = {}
@inPorts =
keys: new noflo.ArrayPort 'string'
+ allpackets: new noflo.ArrayPort 'string'
collect: new noflo.ArrayPort 'all'
release: new noflo.Port 'bang'
clear: new noflo.Port 'bang'
@@ -24,6 +26,13 @@ class CollectObject extends noflo.Component
for key in keys
@keys.push key
+ @inPorts.allpackets.on 'data', (key) =>
+ allpackets = key.split ','
+ if allpackets.length > 1
+ @keys = []
+ for key in allpackets
+ @allpackets.push key
+
@inPorts.collect.once 'connect', =>
@subscribeSockets()
@@ -52,6 +61,11 @@ class CollectObject extends noflo.Component
groupId = @groupId @groups[id]
unless @data[groupId]
@data[groupId] = {}
+ if @allpackets.indexOf(@keys[id]) isnt -1
+ unless @data[groupId][@keys[id]]
+ @data[groupId][@keys[id]] = []
+ @data[groupId][@keys[id]].push data
+ return
@data[groupId][@keys[id]] = data
socket.on 'endgroup', =>
return unless @groups[id]

0 comments on commit 8f5ecdb

Please sign in to comment.
Something went wrong with that request. Please try again.