Fixed ordering of blink init calls per @dceejay

This commit is contained in:
Andy Piper 2014-01-14 10:31:58 +00:00
parent 24a8c6df32
commit d81828fdd9
1 changed files with 8 additions and 7 deletions

View File

@ -16,6 +16,7 @@
var RED = require(process.env.NODE_RED_HOME+"/red/red");
var Blink1 = require("node-blink1");
var blink1 = new Blink1.Blink1();
function Blink1Node(n) {
RED.nodes.createNode(this,n);
@ -63,13 +64,13 @@ function Blink1Node(n) {
node.warn("No Blink1 found");
}
});
// This ought to work but seems to cause more hangs on closing than not...
//this.on("close", function() {
//if (blink1 && typeof blink1.close == "function") {
//blink1.close();
//}
//});
var blink1 = new Blink1.Blink1();
//This ought to work but seems to cause more hangs on closing than not...
this.on("close", function() {
if (blink1 && typeof blink1.close == "function") {
blink1.close();
}
});
// var blink1 = new Blink1.Blink1();
}
catch(e) {
node.error("No Blink1 found (" + e + ")");