Add "use strict" to most core nodes.

(skipping ones that may have other work in progress)
This commit is contained in:
Dave C-J
2014-05-29 22:13:21 +01:00
parent 7ad28de52a
commit 2cdaed1325
22 changed files with 128 additions and 99 deletions

View File

@@ -15,9 +15,10 @@
**/
module.exports = function(RED) {
"use strict";
var FeedParser = require("feedparser");
var request = require("request");
function FeedParseNode(n) {
RED.nodes.createNode(this,n);
this.url = n.url;
@@ -54,18 +55,17 @@ module.exports = function(RED) {
};
this.interval_id = setInterval(getFeed,node.interval);
getFeed();
} else {
this.error("Invalid url");
}
}
RED.nodes.registerType("feedparse",FeedParseNode);
FeedParseNode.prototype.close = function() {
if (this.interval_id != null) {
clearInterval(this.interval_id);
}
}
}
}

View File

@@ -15,6 +15,7 @@
**/
module.exports = function(RED) {
"use strict";
var util = require('util');
var nodemailer = require("nodemailer");
var Imap = null;

View File

@@ -15,9 +15,10 @@
**/
module.exports = function(RED) {
"use strict";
var irc = require("irc");
var util = require("util");
// The Server Definition - this opens (and closes) the connection
function IRCServerNode(n) {
RED.nodes.createNode(this,n);
@@ -32,8 +33,8 @@ module.exports = function(RED) {
});
}
RED.nodes.registerType("irc-server",IRCServerNode);
// The Input Node
function IrcInNode(n) {
RED.nodes.createNode(this,n);
@@ -50,7 +51,7 @@ module.exports = function(RED) {
}
this.ircclient = this.serverConfig.ircclient;
var node = this;
this.ircclient.addListener('message', function (from, to, message) {
//util.log(from + ' => ' + to + ': ' + message);
var msg = { "topic":from, "from":from, "to":to, "payload":message };
@@ -60,7 +61,7 @@ module.exports = function(RED) {
var msg = { "topic":from, "from":from, "to":"PRIV", "payload":message };
node.send([msg,null]);
});
this.ircclient.addListener('join', function(channel, who) {
var msg = { "payload": { "type":"join", "who":who, "channel":channel } };
node.send([null,msg]);
@@ -90,11 +91,11 @@ module.exports = function(RED) {
var msg = { "payload": { "type": "names", "channel": channel, "names": nicks} };
node.send([null, msg]);
});
}
RED.nodes.registerType("irc in",IrcInNode);
// The Output Node
function IrcOutNode(n) {
RED.nodes.createNode(this,n);
@@ -112,7 +113,7 @@ module.exports = function(RED) {
}
this.ircclient = this.serverConfig.ircclient;
var node = this;
this.on("input", function(msg) {
if (Object.prototype.toString.call( msg.raw ) === '[object Array]') {
var m = msg.raw;