Skip to content
This repository has been archived by the owner on May 19, 2019. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/c58/marsdb
Browse files Browse the repository at this point in the history
  • Loading branch information
c58 committed Mar 10, 2016
2 parents 7bb0f2d + 522b712 commit 914eb59
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
15 changes: 9 additions & 6 deletions lib/Collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,20 @@ let _defaultIdGenerator = ShortIdGenerator;
// the second execution cycle
let _startedUp = false;
let _startUpQueue = [];
let _startUpTimeout = 0;
let _startUpId = 0;

// Internals
export function _resetStartup() {
clearTimeout(_startUpTimeout);
_startUpId += 1;
_startUpQueue = [];
_startedUp = false;
_startUpTimeout = setTimeout(() => {
_startedUp = true;
_each(_startUpQueue, fn => fn());
_startUpQueue = [];
const currStartId = _startUpId;
setTimeout(() => {
if (currStartId === _startUpId) {
_startedUp = true;
_each(_startUpQueue, fn => fn());
_startUpQueue = [];
}
}, 0);
}

Expand Down

0 comments on commit 914eb59

Please sign in to comment.