1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Updated Input node feature definitions (markdown)

zobalogh 2014-10-29 08:08:37 -07:00
parent c61818fb74
commit 73a7ad4f28

@ -1,6 +1,6 @@
This page defines the features and design conventions that each input node should adhere to. The page is currently under development and changes to its contents are possible. Once the behaviour is agreed upon, these conventions are going to be migrated onto the Node-RED website for easy reference.
Input nodes MUST:
### Input nodes MUST:
* Create a new msg JavaScript object for every distinctive output they wish to generate. This is to be achieved for example by:
@ -9,4 +9,18 @@ Input nodes MUST:
msg = {};
doSomethingWithMsg(node, msg);
});
</code>
</code>
* It is essential for msg to be an object, otherwise it cannot be extended with additional fields in further nodes
### Input nodes SHOULD:
* Have clearly defined behaviour that triggers new msg objects to be sent upon meeting clearly defined conditions
### Input nodes COULD:
* Poll at regular intervals to see if msg trigger conditions are met:
<code>
node.interval = setInterval(function() {
node.emit("input", {});
}, REPEAT_IN_MILLIS);
</code>
* Alternatively they could fire by being triggered by callbacks => TODO define behaviour here
* Reserve the right not to send anything at all, ever if conditions are never met