Make @bind the same as Surma's implementation

This commit is contained in:
Jason Miller
2018-03-30 13:32:16 -04:00
parent 8f452ddf6d
commit fc84c81a47

View File

@@ -39,11 +39,11 @@ export function bind(target: any, propertyKey: string, descriptor: PropertyDescr
// define an instance property pointing to the bound function. // define an instance property pointing to the bound function.
// This effectively "caches" the bound prototype method as an instance property. // This effectively "caches" the bound prototype method as an instance property.
get() { get() {
let boundFunction = descriptor.value.bind(this); let bound = descriptor.value.bind(this);
Object.defineProperty(this, propertyKey, { Object.defineProperty(this, propertyKey, {
value: boundFunction value: bound
}); });
return boundFunction; return bound;
} }
}; };
} }