Re: [nodejs] Re: how to create a singleton

2013-11-21 Thread Kamil Leszczuk
For example, if I have a module for emailing with a send() method on it, I don't have it export a constructor; I have it export an object. That object might maintain some state or it might not. When the module is subsequently require()'d, it will have any state that it has accumulated since.

Re: [nodejs] Re: how to create a singleton

2013-11-21 Thread Kamil Leszczuk
Aah, nevermind then, I misunerstood ;) 21 lis 2013 16:36 Gregg Caines gr...@caines.ca napisaƂ(a): Yeah... that's what I'm saying :) G On Thu, Nov 21, 2013 at 7:33 AM, Kamil Leszczuk kamit...@gmail.comwrote: For example, if I have a module for emailing with a send() method on it, I don't

[nodejs] Re: Passing the socket into the callback

2013-08-21 Thread Kamil Leszczuk
'this' will be bound to the EventEmitter instance. This behaviour is implemented around here: https://github.com/joyent/node/blob/master/lib/events.js#L100. So, the following code works as expected (prints called!). var SomeClass = function () { }; util.inherits(SomeClass, EventEmitter); var