Closed
Description
Example:
var MyExample = function() {};
MyExample.prototype.exampleValue = true;
MyExample.prototype.getExampleValuePrototype = function() { return this.exampleValue; }
var myInstance = new MyExample();
myInstance.getExampleValue = function() { return this.exampleValue; }
alert(myInstance.getExampleValue.apply({}));
alert(myInstance.getExampleValuePrototype.apply({}));
// result: both alert 'undefined'
_.bindAll(myInstance);
alert(myInstance.getExampleValue.apply({}));
alert(myInstance.getExampleValuePrototype.apply({}));
// result: getExampleValue alerts 'true', getExampleValuePrototype alerts 'undefined'
_.bindAll(myInstance, 'getExampleValuePrototype');
alert(myInstance.getExampleValue.apply({}));
alert(myInstance.getExampleValuePrototype.apply({}));
// result: both alert 'true'