いくつかの関数があり、それは何か長い作業を行い、コールバックを提供します。
someFunc: function(argument, callback, context) {
// do something long
// call callback function
callback(context);
}
アプリケーションでは、この関数を使用します
someFunc('bla-bla', function (context) {
// do something with this scope
context.anotherFunc();
}, this);
context
パラメータを渡さずにコールバック関数を実装するには?
このようなものが必要です:
someFunc('bla-bla', function () {
// do something with this scope
this.anotherFunc();
}, this);