[nodejs] Re: OO usage howto? (I think it's something about scopes.)

2013-03-27 Thread Perrier
Thanks. I'm coming from c# but now as I've found Felix's Node.js Style Guideand will try to follow it. 2013. március 26., kedd 17:15:24 UTC+1 időpontban greelgorke a következőt írta: > > this.Listen should be this.listen. UppersCase names are per convention > Co

[nodejs] Re: OO usage howto? (I think it's something about scopes.)

2013-03-26 Thread greelgorke
this.Listen should be this.listen. UppersCase names are per convention Constructors, your Listen isn't. Am Dienstag, 26. März 2013 16:45:02 UTC+1 schrieb Perrier: > > Thanks for the answers, finally I have figured it out somehow. You can see > the working class below, please take suggestions if

[nodejs] Re: OO usage howto? (I think it's something about scopes.)

2013-03-26 Thread Perrier
Thanks for the answers, finally I have figured it out somehow. You can see the working class below, please take suggestions if it contains bugs or it isn't nice enough: function TCPServer(listenAddress, listenPort) { /** @private */ var HOST = listenAddress; /** @private */ var PORT = listenPort

Re: [nodejs] Re: OO usage howto? (I think it's something about scopes.)

2013-03-25 Thread Tim Caswell
See the last diagram in http://howtonode.org/object-graphs to understand that functions on objects are in no-way bound to the object you initially assigned them to. On Mon, Mar 25, 2013 at 11:30 AM, mgutz wrote: > You may also need to bind `onConnection` to `this` otherwise `this.onData` > woul

[nodejs] Re: OO usage howto? (I think it's something about scopes.)

2013-03-25 Thread mgutz
You may also need to bind `onConnection` to `this` otherwise `this.onData` would be invalid as well. On Monday, March 25, 2013 9:28:06 AM UTC-7, mgutz wrote: > > > Shouldn't `stream.on('data', onData);` be `this.onData`? > > > > > > On Monday, March 25, 2013 8:44:02 AM UTC-7, Perrier wrote: >> >>

[nodejs] Re: OO usage howto? (I think it's something about scopes.)

2013-03-25 Thread mgutz
Shouldn't `stream.on('data', onData);` be `this.onData`? On Monday, March 25, 2013 8:44:02 AM UTC-7, Perrier wrote: > > Hi, > > I cannot reach some of the fields of my class and I don't understand why. > Someone please take a look at my code. This is the Nth one, I was changing > this to va