From d81828fdd97dda0482f9f69558303e6f479848ad Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Tue, 14 Jan 2014 10:31:58 +0000 Subject: [PATCH] Fixed ordering of blink init calls per @dceejay --- hardware/blink/77-blink1.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hardware/blink/77-blink1.js b/hardware/blink/77-blink1.js index 5c5b41ee..10a9244c 100644 --- a/hardware/blink/77-blink1.js +++ b/hardware/blink/77-blink1.js @@ -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 + ")");