The way to solve this problem is to pass the object you are viewing "this" inside the test function ...
function Test(fn, scope, args) {
fn.apply(scope, args);
}
Test(User.Show, User, []);
If the args array allows you to optionally pass any arguments that may arise. You can also leave the test function as is and simply pass an anonymous function ...
Test(function() {User.Show()});
source
share