Skip to content

Commit e162fc4

Browse files
committed
Fixing the binding of the callback instead of using a self variable.
1 parent 0e7f266 commit e162fc4

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

google-client-api.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@
3939
* Loads the client library when the api js has loaded.
4040
*/
4141
loadClient: function() {
42-
var self = this;
4342
gapi.load("client", function() {
44-
self.fire(self.notifyEvent, arguments);
45-
});
43+
this.fire(this.notifyEvent, arguments);
44+
}.bind(this));
4645
},
4746

4847
/**
@@ -234,11 +233,10 @@
234233
},
235234

236235
createSelfRemovingListener: function(eventName) {
237-
var self = this;
238236
var handler = function () {
239-
loaders_[self.name].removeEventListener(eventName, handler);
240-
self.loadApi();
241-
};
237+
loaders_[this.name].removeEventListener(eventName, handler);
238+
this.loadApi();
239+
}.bind(this);
242240

243241
return handler;
244242
},

0 commit comments

Comments
 (0)