cm-web-modules
Advanced tools
Comparing version 1.11.11 to 1.11.12
{ | ||
"name": "cm-web-modules", | ||
"version": "1.11.11", | ||
"version": "1.11.12", | ||
"description": "Collection of clean and small ES6 modules for the web", | ||
@@ -5,0 +5,0 @@ "main": "src/LibraryManager.js", |
@@ -11,2 +11,8 @@ /** | ||
constructor(props = {}) { | ||
this.props = { | ||
onStateChanged: () => {}, // callback an start and stop | ||
onTimeChanged: () => {}, // callback, to read out the time value, called every `tickResolution` ms | ||
tickResolution: 100 // milliseconds of the time resolution | ||
} | ||
Object.assign(this.props, props) | ||
this.startDate = null | ||
@@ -18,4 +24,2 @@ this.endDate = null | ||
this.timer = null | ||
this.timerStateChanged = props.onStateChanged | ||
this.timerSecondsChanged = props.onSecondsChanged | ||
} | ||
@@ -36,5 +40,5 @@ | ||
this.tick() | ||
}, 100) | ||
this.timerStateChanged(this.running()) | ||
this.timerSecondsChanged(this.secondsExpiredTillLastPause) | ||
}, this.props.tickResolution) | ||
this.props.onStateChanged(this.running()) | ||
this.props.onTimeChanged(this.secondsExpiredTillLastPause) | ||
} | ||
@@ -50,3 +54,3 @@ } | ||
this.secondsExpiredSinceLastStart = 0 | ||
this.timerStateChanged(this.running()) | ||
this.props.onStateChanged(this.running()) | ||
} | ||
@@ -60,4 +64,4 @@ } | ||
this.dateAtLatestStart = new Date() | ||
this.timerSecondsChanged(this.secondsExpired()) | ||
this.timerStateChanged(this.running()) | ||
this.props.onTimeChanged(this.secondsExpired()) | ||
this.props.onStateChanged(this.running()) | ||
@@ -70,3 +74,3 @@ } | ||
this.secondsExpiredSinceLastStart = newSecondsExpired | ||
this.timerSecondsChanged(this.secondsExpired()) | ||
this.props.onTimeChanged(this.secondsExpired()) | ||
} | ||
@@ -73,0 +77,0 @@ } |
Sorry, the diff of this file is not supported yet
102325
1904