Skip to content

Commit c46d61d

Browse files
alurmarijnh
authored andcommitted
Switch to +new Date
1 parent 5dade13 commit c46d61d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/util/misc.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,19 @@ export class Delayed {
3737
}
3838
onTimeout(self) {
3939
self.id = 0
40-
if (self.time < Date.now()) {
40+
if (self.time < +new Date) {
4141
self.f()
4242
} else {
43-
setTimeout(self.handler, self.time - Date.now())
43+
setTimeout(self.handler, self.time - +new Date)
4444
}
4545
}
4646
set(ms, f) {
4747
this.f = f
48-
const time = Date.now() + ms
48+
const time = +new Date + ms
4949
if (!this.id || time < this.time) {
5050
clearTimeout(this.id)
5151
this.id = setTimeout(this.handler, ms)
52+
this.time = time
5253
}
5354
}
5455
}

0 commit comments

Comments
 (0)