1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-10-31 07:32:59 +00:00

Use Date.now() instead of new Date()

Just for when what we actually want is a millisecond counter.

Interesting video about this:

https://www.youtube.com/watch?v=Vo72W1HWeFI
This commit is contained in:
Jermolene
2014-04-14 09:02:52 +01:00
parent 22a529b28d
commit e366aa3746
4 changed files with 8 additions and 8 deletions

View File

@@ -57,7 +57,7 @@ PageScroller.prototype.scrollIntoView = function(element) {
var duration = $tw.utils.getAnimationDuration();
// Now get ready to scroll the body
this.cancelScroll();
this.startTime = new Date();
this.startTime = Date.now();
var scrollPosition = $tw.utils.getScrollPosition();
// Get the client bounds of the element and adjust by the scroll position
var clientBounds = element.getBoundingClientRect(),
@@ -94,7 +94,7 @@ PageScroller.prototype.scrollIntoView = function(element) {
if(duration <= 0) {
t = 1;
} else {
t = ((new Date()) - self.startTime) / duration;
t = ((Date.now()) - self.startTime) / duration;
}
if(t >= 1) {
self.cancelScroll();