Ensure we only callback once for onReady()

This commit is contained in:
Johannes Zellner
2016-07-27 16:34:15 +02:00
parent 3020071fe4
commit b13dd55fc6

View File

@@ -175,11 +175,14 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
this._readyListener.forEach(function (callback) {
callback();
});
// clear the listeners, we only callback once!
this._readyListener = [];
};
Client.prototype.onReady = function (callback) {
if (this._ready) callback();
this._readyListener.push(callback);
else this._readyListener.push(callback);
};
Client.prototype.onConfig = function (callback) {