Fix the remoting method with the current receiver (this)
This commit is contained in:
parent
cab59eb61b
commit
1f965bfedb
12
lib/scope.js
12
lib/scope.js
|
@ -83,8 +83,8 @@ function defineScope(cls, targetClass, name, params, methods) {
|
||||||
|
|
||||||
// Wrap the property into a function for remoting
|
// Wrap the property into a function for remoting
|
||||||
var fn = function() {
|
var fn = function() {
|
||||||
var f = this[name];
|
var f = cls[name];
|
||||||
f.apply(this, arguments);
|
f.apply(cls, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
fn.shared = true;
|
fn.shared = true;
|
||||||
|
@ -96,8 +96,8 @@ function defineScope(cls, targetClass, name, params, methods) {
|
||||||
cls['__get__' + name] = fn;
|
cls['__get__' + name] = fn;
|
||||||
|
|
||||||
var fn_create = function() {
|
var fn_create = function() {
|
||||||
var f = this[name].create;
|
var f = cls[name].create;
|
||||||
f.apply(this, arguments);
|
f.apply(cls[name], arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
fn_create.shared = true;
|
fn_create.shared = true;
|
||||||
|
@ -109,8 +109,8 @@ function defineScope(cls, targetClass, name, params, methods) {
|
||||||
cls['__create__' + name] = fn_create;
|
cls['__create__' + name] = fn_create;
|
||||||
|
|
||||||
var fn_delete = function() {
|
var fn_delete = function() {
|
||||||
var f = this[name].destroyAll;
|
var f = cls[name].destroyAll;
|
||||||
f.apply(this, arguments);
|
f.apply(cls[name], arguments);
|
||||||
};
|
};
|
||||||
fn_delete.shared = true;
|
fn_delete.shared = true;
|
||||||
fn_delete.http = {verb: 'delete', path: '/' + name};
|
fn_delete.http = {verb: 'delete', path: '/' + name};
|
||||||
|
|
Loading…
Reference in New Issue