Skip to content

Commit 14c1765

Browse files
authored
fix(progress-circle): remove performance.now to support non browser envs (#857)
1 parent 04d1c80 commit 14c1765

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/components/progress-circle/progress-circle.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export class MdProgressCircle implements OnDestroy {
151151
private _animateCircle(animateFrom: number, animateTo: number, ease: EasingFn,
152152
duration: number, rotation: number) {
153153
let id = ++this._lastAnimationId;
154-
let startTime = now();
154+
let startTime = Date.now();
155155
let changeInValue = animateTo - animateFrom;
156156

157157
// No need to animate it if the values are the same
@@ -160,7 +160,7 @@ export class MdProgressCircle implements OnDestroy {
160160
} else {
161161
let animation = (currentTime: number) => {
162162
let elapsedTime = Math.max(
163-
0, Math.min((currentTime || now()) - startTime, duration));
163+
0, Math.min((currentTime || Date.now()) - startTime, duration));
164164

165165
this.currentPath = getSvgArc(
166166
ease(elapsedTime, animateFrom, changeInValue, duration),
@@ -246,17 +246,6 @@ function clamp(v: number) {
246246
}
247247

248248

249-
/**
250-
* Returns the current timestamp either based on the performance global or a date object.
251-
*/
252-
function now() {
253-
if (typeof performance !== 'undefined' && performance.now) {
254-
return performance.now();
255-
}
256-
return Date.now();
257-
}
258-
259-
260249
/**
261250
* Converts Polar coordinates to Cartesian.
262251
*/

0 commit comments

Comments
 (0)