1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00
node-red/packages/node_modules/@node-red/nodes/examples/function/function/03 - Send messages asynchronously.json
2020-06-24 14:43:27 +01:00

1 line
1.2 KiB
JSON

[{"id":"cc74476e.cbdf68","type":"inject","z":"e099b273.21259","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello, World!","payloadType":"str","x":190,"y":100,"wires":[["7d90286.706e9d8"]]},{"id":"909906c3.ea9f58","type":"debug","z":"e099b273.21259","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":100,"wires":[]},{"id":"d5fc0512.4cd9c8","type":"comment","z":"e099b273.21259","name":"sending messages asynchronously","info":"Function node can asynchronously send a messages to output ports by calling `node.send` function.\n\nSee Node-RED user guide about [functions](https://nodered.org/docs/user-guide/writing-functions).","x":200,"y":40,"wires":[]},{"id":"7d90286.706e9d8","type":"function","z":"e099b273.21259","name":"wait 2s then send message","func":"// setTimeout calls calls specified callback function asynchronously after a specified time\nsetTimeout(function () {\n node.send(msg);\n}, 2*1000);\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":420,"y":100,"wires":[["909906c3.ea9f58"]]}]