From c7c8a9bbe2688d22049ea1d9e8612f94c39961de Mon Sep 17 00:00:00 2001 From: dceejay Date: Sun, 4 Jan 2015 21:14:00 +0000 Subject: [PATCH] Correct emoncms package.json (remove extra ,) Update sample nodes in line with main nodes directory --- 99-sample.html.demo | 2 +- 99-sample.js.demo | 19 +++++++++++-------- io/emoncms/package.json | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/99-sample.html.demo b/99-sample.html.demo index 06092b03..4dcc8ba5 100644 --- a/99-sample.html.demo +++ b/99-sample.html.demo @@ -17,7 +17,7 @@ - + diff --git a/99-sample.js.demo b/99-sample.js.demo index 5147e092..ed86e0d7 100644 --- a/99-sample.js.demo +++ b/99-sample.js.demo @@ -14,11 +14,11 @@ * limitations under the License. **/ -// If you use this as a template, replace IBM Corp. with your own name. +// If you use this as a template, update the copyright with your own name. // Sample Node-RED node file -// Require main module + module.exports = function(RED) { "use strict"; // require any external libraries we may need.... @@ -31,6 +31,7 @@ module.exports = function(RED) { // Store local copies of the node configuration (as defined in the .html) this.topic = n.topic; + var node = this; // Do whatever you need to do in here - declare callbacks etc // Note: this sample doesn't do anything much - it will only send @@ -41,23 +42,25 @@ module.exports = function(RED) { msg.payload = "Hello world !" // send out the message to the rest of the workspace. - this.send(msg); + // ... this message will get sent at startup so you may not see it in a debug node. + node.send(msg); // respond to inputs.... - this.on('input', function (msg) { + node.on('input', function (msg) { node.warn("I saw a payload: "+msg.payload); // in this example just send it straight on... should process it here really - this.send(msg); - } + node.send(msg); + }); - this.on("close", function() { + node.on("close", function() { // Called when the node is shutdown - eg on redeploy. // Allows ports to be closed, connections dropped etc. - // eg: this.client.disconnect(); + // eg: node.client.disconnect(); }); } // Register the node by name. This must be called before overriding any of the // Node functions. RED.nodes.registerType("sample",SampleNode); + } diff --git a/io/emoncms/package.json b/io/emoncms/package.json index b78b1b75..76638db9 100644 --- a/io/emoncms/package.json +++ b/io/emoncms/package.json @@ -25,5 +25,5 @@ "name": "dceejay", "email": "ceejay@vnet.ibm.com" } - ], + ] }