summaryrefslogtreecommitdiffstats
path: root/src/animation
diff options
context:
space:
mode:
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