summaryrefslogtreecommitdiffstats
path: root/src/animation
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-21 21:33:03 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-21 21:33:03 +0100
commitddf28b67dd55aab000a5e6c44f2089c9f0b91ff8 (patch)
treec9b2e6530feb281cb9e03642b69fb4857baa8b7a /src/animation
parentefc383d4dc005046a76da4134cd25e8aa11b8042 (diff)
downloadsvg.js-ddf28b67dd55aab000a5e6c44f2089c9f0b91ff8.tar.gz
svg.js-ddf28b67dd55aab000a5e6c44f2089c9f0b91ff8.zip
add default parameter for timeSource
Diffstat (limited to 'src/animation')
-rw-r--r--src/animation/Timeline.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/animation/Timeline.js b/src/animation/Timeline.js
index 6e1ed8d..a0d8069 100644
--- a/src/animation/Timeline.js
+++ b/src/animation/Timeline.js
@@ -10,15 +10,17 @@ var makeSchedule = function (runnerInfo) {
return { start: start, duration: duration, end: end, runner: runnerInfo.runner }
}
+const defaultSource = function () {
+ let w = globals.window
+ return (w.performance || w.Date).now()
+}
+
export default class Timeline extends EventTarget {
// Construct a new timeline on the given element
- constructor () {
+ constructor (timeSource = defaultSource) {
super()
- this._timeSource = function () {
- let w = globals.window
- return (w.performance || w.Date).now()
- }
+ this._timeSource = timeSource
// Store the timing variables
this._startTime = 0