Bind function to context with 'method' option

This commit is contained in:
Mariusz Nowak
2013-02-12 15:36:30 +01:00
parent fb4439692d
commit 83f31df6f7

View File

@@ -34,7 +34,7 @@ require('../_base').ext.method = function (method, options, fn, configure) {
prop.get = function () {
if ((name !== selfName) && this.hasOwnProperty(name)) return this[name];
options.context = this;
descriptor.value = configure(fn, options);
descriptor.value = configure(fn.bind(this), options);
defineProperty(this, name, descriptor);
return this[name];
};