From 33c9583969ce74c5b408575a04b006926986d90e Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sun, 8 Sep 2013 12:03:40 -0700 Subject: [PATCH] Updated API Reference (markdown) --- API-Reference.md | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/API-Reference.md b/API-Reference.md index a499439..265dbb4 100644 --- a/API-Reference.md +++ b/API-Reference.md @@ -51,9 +51,10 @@ The class defines the following functions/events: # node.send(msg) -This function causes the message(s) to be sent on to any nodes wired to this one. A node can have multiple outputs and each output can be wired to multiple nodes. +This function causes messages to be sent on to any nodes wired to this one. A node can have multiple outputs and each output can be wired to multiple nodes. -- If `msg` is a single message, it is sent on to any nodes wired to the first output. +- If `msg` is undefined, no message is sent on. +- If `msg` is a single message, it is sent to all nodes wired to the first output. - If `msg` is an array, each element of the array is passed to the corresponding output. - If any of these elements is itself an array, each element of that array is sent to the connected nodes in order. @@ -88,7 +89,21 @@ For example, the `Inject` node clears the timer if one had been set: Three log level functions are provided for convenience. They format the log message with the time-stamp and ID of the node. If the `Debug` node is active, the log messages will appear in the debug sidebar. # RED.nodes.createNode(node,definition) - + +This function should be the first thing called in a node's constructor function, passing in `this` and the node's definition object: + + function InjectNode(n) { + RED.nodes.createNode(this,n); + # RED.nodes.registerType(type,node) - + +After defining a node's constructor, it needs to be registered with this function. This must be done immediately after the constructor and before any additional functions are added to its prototype, for example, if the node defines its own [close](#server-Node-close) function. + + function InjectNode(n) { + ... + ... + } + RED.nodes.registerType("inject",InjectNode); + + # RED.library.register(type) \ No newline at end of file