`bind` returns a new function, which has it's context `this` set to whatever you pass in, along with arguments partially applied.
`apply` calls the function, using the context object you provide and the arguments provided in an array. (`apply` also has a sister function `call`, which also calls the function with the context object you provide and the arguments you provide individually).
Both call and apply call the function it's given immediately.
That's why bind is useful in the context of event handlers--you want code to run at some later time. If you do this with 'apply', you still need a wrapper function.
Moreover, there is some manual manipulation of the `arguments` special object you need to do in order to get this to work with apply. Without bind you'd have to do something like
function tweetWithType(tweetType) {
return function() {
var newArgs = Array.prototype.slice.call(arguments);
newArgs.unshift(tweetType);
this.handleStreamEvent.apply(this, newArgs);
};
}
to be able to call it like this.on('tweet', tweetWithType('tweet'));
and you STILL wouldn't be right, because `this` within tweetWithType is not the `this` you expect. You'd have to do the whole var self = this;
thing.