Update node-red-nodes social nodes to use strict and pass jshint scan

This commit is contained in:
Dave C-J
2014-06-28 23:34:59 +01:00
parent 9b487098ae
commit 62956b0bb8
6 changed files with 462 additions and 453 deletions

View File

@@ -14,26 +14,28 @@
* limitations under the License.
**/
var RED = require(process.env.NODE_RED_HOME+"/red/red");
var growl = require('growl');
var imagefile = process.env.NODE_RED_HOME+"/public/node-red.png";
module.exports = function(RED) {
"use strict";
var growl = require('growl');
var imagefile = process.env.NODE_RED_HOME+"/public/node-red.png";
function NotifyNode(n) {
RED.nodes.createNode(this,n);
this.title = n.title;
var node = this;
this.on("input",function(msg) {
var titl = this.title || msg.topic;
if (typeof(msg.payload) == 'object') {
msg.payload = JSON.stringify(msg.payload);
}
if (typeof(titl) != 'undefined') {
growl(msg.payload, { title: titl, image: imagefile });
}
else {
growl(msg.payload, { image: imagefile });
}
});
function NotifyNode(n) {
RED.nodes.createNode(this,n);
this.title = n.title;
var node = this;
this.on("input",function(msg) {
var titl = this.title || msg.topic;
if (typeof(msg.payload) == 'object') {
msg.payload = JSON.stringify(msg.payload);
}
if (typeof(titl) != 'undefined') {
growl(msg.payload, { title: titl, image: imagefile });
}
else {
growl(msg.payload, { image: imagefile });
}
});
}
RED.nodes.registerType("notify",NotifyNode);
}
RED.nodes.registerType("notify",NotifyNode);