Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.

Commit

Permalink
Use _.uniqueId() for loadCounter
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Bataev committed Dec 27, 2012
1 parent c447801 commit 0468fa9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/loading.js
Expand Up @@ -7,10 +7,8 @@ Thorax.setRootObject = function(obj) {
rootObject = obj;
};

var _loadCounter = 0;

Thorax.loadHandler = function(start, end, context) {
var loadCounter = _loadCounter++;
var loadCounter = _.uniqueId();
return function(message, background, object) {
var self = context || this;
self._loadInfo = self._loadInfo || [];
Expand Down Expand Up @@ -79,7 +77,7 @@ Thorax.loadHandler = function(start, end, context) {

// If stopping make sure we don't run a start
clearTimeout(loadInfo.timeout);
loadInfo = self._loadInfo[loadCounter] =undefined;
loadInfo = self._loadInfo[loadCounter] = undefined;
}
} catch (e) {
Thorax.onException('loadEnd', e);
Expand Down

0 comments on commit 0468fa9

Please sign in to comment.