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

fix up issues with function node types

- node.status add overload
- remove examples as they dont render correctly
- correct Number and Object types to number and object
This commit is contained in:
Steve-Mcl 2021-06-11 18:44:37 +01:00
parent 7d24e5b279
commit aa6ec60c34

View File

@ -27,7 +27,7 @@ interface NodeStatus {
/** The shape property can be: ring or dot */ /** The shape property can be: ring or dot */
shape?: string, shape?: string,
/** The text to display */ /** The text to display */
text?: string text?: string|boolean|number
} }
declare class node { declare class node {
@ -35,48 +35,33 @@ declare class node {
* Send 1 or more messages asynchronously * Send 1 or more messages asynchronously
* @param {object | object[]} msg The msg object * @param {object | object[]} msg The msg object
* @param {Boolean} [clone=true] Flag to indicate the `msg` should be cloned. Default = `true` * @param {Boolean} [clone=true] Flag to indicate the `msg` should be cloned. Default = `true`
* @example Send 1 msg to output 1
* ```javascript
* node.send({ payload: "a" });
* ```
* @example Send 2 msg to 2 outputs
* ```javascript
* node.send([{ payload: "output1" }, { payload: "output2" }]);
* ```
* @example Send 3 msg to output 1
* ```javascript
* node.send([[{ payload: 1 }, { payload: 2 }, { payload: 3 }]]);
* ```
* @see node-red documentation [writing-functions: sending messages asynchronously](https://nodered.org/docs/user-guide/writing-functions#sending-messages-asynchronously) * @see node-red documentation [writing-functions: sending messages asynchronously](https://nodered.org/docs/user-guide/writing-functions#sending-messages-asynchronously)
*/ */
static send(msg:object, clone?:Boolean); static send(msg:object|object[], clone?:Boolean): void;
/** Inform runtime this instance has completed its operation */ /** Inform runtime this instance has completed its operation */
static done(); static done();
/** Send an error to the console and debug side bar. Include `msg` in the 2nd parameter to trigger the catch node. */ /** Send an error to the console and debug side bar. Include `msg` in the 2nd parameter to trigger the catch node. */
static error(err:string|Error, msg?:object); static error(err:string|Error, msg?:object);
/** Log a warn message to the console and debug sidebar */ /** Log a warn message to the console and debug sidebar */
static warn(warning:string|Object); static warn(warning:string|object);
/** Log an info message to the console (not sent to sidebar)' */ /** Log an info message to the console (not sent to sidebar)' */
static log(info:string|Object); static log(info:string|object);
/** Set the status icon and text underneath the node. /** Sets the status icon and text underneath the node.
* @param {NodeStatus} status - The status object `{fill, shape, text}` * @param {NodeStatus} status - The status object `{fill, shape, text}`
* @example clear node status
* ```javascript
* node.status({});
* ```
* @example set node status to red ring with text
* ```javascript
* node.status({fill:"red",shape:"ring",text:"error"})
* ```
* @see node-red documentation [writing-functions: adding-status](https://nodered.org/docs/user-guide/writing-functions#adding-status) * @see node-red documentation [writing-functions: adding-status](https://nodered.org/docs/user-guide/writing-functions#adding-status)
*/ */
static status(status:NodeStatus); static status(status:NodeStatus);
/** Sets the status text underneath the node.
* @param {string} status - The status to display
* @see node-red documentation [writing-functions: adding-status](https://nodered.org/docs/user-guide/writing-functions#adding-status)
*/
static status(status:string|boolean|number);
/** the id of this node */ /** the id of this node */
public readonly id:string; public readonly id:string;
/** the name of this node */ /** the name of this node */
public readonly name:string; public readonly name:string;
/** the number of outputs of this node */ /** the number of outputs of this node */
public readonly outputCount:Number; public readonly outputCount:number;
} }
declare class context { declare class context {
/** Get a value from context */ /** Get a value from context */