This commit is contained in:
Bret Comnes
2020-02-12 16:58:30 -07:00
parent 383cb4ca53
commit 80459935e1
98 changed files with 9972 additions and 1 deletions

34
node_modules/async-neocities/lib/timer.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
/**
* Simple timer lets you record start and stop times, with an elapsed time getter.
*/
class SimpleTimer {
constructor (startTime) {
this.start = startTime || Date.now()
this.end = null
this.stopped = false
}
get elapsed () {
if (this.stopped) {
return this.end - this.start
} else {
return Date.now() - this.start
}
}
stop () {
if (this.stopped) return
this.stopped = true
this.end = Date.now()
}
toString () {
return this.elapsed
}
toJSON () {
return this.elapsed
}
}
module.exports = SimpleTimer