I don't understand why:
setTimeout(function (x, y, z) {
// ...
}, this, 1000)
is better than:
setTimeout(function (x, y, z) {
// ...
}.bind(this), 1000)
The problem is that it puts `this` at the bottom of the function,
instead of signaling it at the top when you enter the function
visually. That's the problem ()=>{} addresses. If you don't like
bind(), and can't wait for fat-arrow, then do `var me = this` and deal
with it that way, or wrap your functions like:
function foo (me) { return function () {
me.doWhatever()
}}
setTimeout(foo(this), 1000)
Sorry. It's a lovely suggestion, but we don't need this in core. The
answer is no.
On Sun, Jun 10, 2012 at 12:20 AM, Jorge <[email protected]> wrote:
> On Jun 8, 2012, at 8:06 PM, AJ ONeal wrote:
>
>> I would like to propose that an additional parameter, `context` be added to
>> core node modules that accept callbacks to give this-ness to the callback.
>
> But don't call it context please the proper name is receiver. A context in JS
> is much more than "this" :-P
> --
> Jorge.