Skip to content

Commit 55becda

Browse files
authored
Merge pull request #178 from s0meone/singleton
Make sure only one instance is started
2 parents d8192ab + f23e3d4 commit 55becda

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/openzwave-shared.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@ for (var k in EventEmitter.prototype) {
2727
addonModule.Emitter.prototype[k] = EventEmitter.prototype[k];
2828
}
2929

30-
module.exports = addonModule.Emitter;
30+
var instance;
31+
module.exports = function(options) {
32+
if (!instance) instance = new addonModule.Emitter(options);
33+
return instance;
34+
}

0 commit comments

Comments
 (0)