我想知道如何调用waitForPin
在这一行:的Javascript范围问题的OAuth
setTimeout(this.waitForPin, 100);
文件:
// namespace our code
window.App = {};
// my class (no Class.create in JQuery so code in native JS)
App.Something = function() {
};
// add functions to the prototype
App.Something.prototype = {
// automatically called
initialize: function(name, sound) {
this.wnd;
this.config = {
// some vars
};
this.oauth = new OAuth(this.config);
// attach event handlers, binding to 'this' object
$("#request_token").click($.proxy(this.request_token, this));
},
request_token: function() {
this.oauth.fetchRequestToken(this.openAuthoriseWindow, this.failureHandler);
},
openAuthoriseWindow: function (url) {
this.wnd = window.open(url, 'authorise');
setTimeout(this.waitForPin, 100); // how to call waitForPin here?
},
waitForPin : function (scope) {
// do sth
}
};
什么问题,这是正确的? –