mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Update node-red-nodes social nodes to use strict and pass jshint scan
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user