I agree with Brett, but Id like to add something to this:

2012/12/11 spqr <[email protected]>

> Sure, I worked around it by getting a reference to the object I really
> want and passing it in to the
> function as an argument (annoying and ugly, but workable).
>


met 
Function.prototype.bind<https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind>.
You can basically use it as follows:

function sayHello() {
  console.log('hello', this);
}
var helloFoo = sayHello.bind({foo: 'bar'});

helloFoo(); //will print    hello {foo: 'bar'}

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to