noflo/noflo — pull request #198 by trustmaster (2014-06-22 20:17:47+00:00)
Title: Params option for WirePattern

Params are inports which are used by a component but aren't changed on each activation. They are normally set via IIP or on startup/reconfiguration. Adding the `params` option to `WirePattern` makes it react on new IPs on these ports automatically and save values for them in `component.params` object. For param inports with `required: true` it also makes the component postpone any processing of incoming data (on ports listed in `in`) until all required parameters have been received.

Example component:

```coffeescript
component = new noflo.Component
component.inPorts.add 'path',
datatype: 'string'
required: true
component.inPorts.add 'delay',
datatype: 'int'
required: false
component.inPorts.add 'line',
datatype: 'string'
component.inPorts.add 'repeat',
datatype: 'int'
component.outPorts.add 'out',
datatype: 'object'
component.outPorts.add 'error',
datatype: 'object'

noflo.WirePattern component,
in: ['line', 'repeat']
out: 'out'
params: ['path', 'delay']
async: true
, (data, groups, out, callback) ->
path = component.params.path
delay = if component.params.delay then component.params.delay else 0
doSomeThing path, delay, data.line, data.repeat, (err, res) ->
return callback err if err
out.send res
callback()
```