|
|
|
|
|
by joetyson
5581 days ago
|
|
You can also create a 'bind' that returns a function that when called applies the context you desire. function bind(fn, selfObj) {
return function() {
return fn.apply(selfObj || window);
};
}
callback = bind(function(){ alert(this.hello); }, this);
|
|