Skip to content

Commit f23e3d4

Browse files
committed
Make sure only one instance is started
This reflects the OpenZWave's Manager singleton and makes it more clear that only one node object has to be initiated.
1 parent b27f5f0 commit f23e3d4

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
@@ -48,4 +48,8 @@ addonModule.Emitter.prototype.removeAllListeners = function(evt) {
4848
return this;
4949
}
5050

51-
module.exports = addonModule.Emitter;
51+
var instance;
52+
module.exports = function(options) {
53+
if (!instance) instance = new addonModule.Emitter(options);
54+
return instance;
55+
}

0 commit comments

Comments
 (0)