Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for browsers removing monotonic clock. Fix for deleting elements …
…in foreach loop
- Loading branch information
Showing
5 changed files
with
132 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
let _jtreeLatestTime = 0 | ||
class AbstractNode { | ||
_getNow() { | ||
return performance.now() | ||
// We add this loop to restore monotonically increasing .now(): | ||
// https://developer.mozilla.org/en-US/docs/Web/API/Performance/now | ||
let time = performance.now() | ||
while (time <= _jtreeLatestTime) { | ||
time += 0.00000000001 | ||
} | ||
_jtreeLatestTime = time | ||
return time | ||
} | ||
} |
Oops, something went wrong.