How can I call native bind method of function-object with coffeescript ? This is the example of what I am trying to achieve:
window.addEventListener("load",function(e){
this._filter(true);
}.bind(this);
)
Just add some parentheses around the function so that you can .bind
the right thing:
window.addEventListener('load', ((e) ->
this._filter(true)
).bind(this))
That will use the native bind
method instead of the usual var _this = this
trickery that CoffeeScript's =>
uses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With