Skip to content

Commit

Permalink
fix(progress-circle): remove performance.now to support non browser e…
Browse files Browse the repository at this point in the history
…nvs (#857)
  • Loading branch information
kara authored Jul 14, 2016
1 parent 04d1c80 commit 14c1765
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/components/progress-circle/progress-circle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class MdProgressCircle implements OnDestroy {
private _animateCircle(animateFrom: number, animateTo: number, ease: EasingFn,
duration: number, rotation: number) {
let id = ++this._lastAnimationId;
let startTime = now();
let startTime = Date.now();
let changeInValue = animateTo - animateFrom;

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

this.currentPath = getSvgArc(
ease(elapsedTime, animateFrom, changeInValue, duration),
Expand Down Expand Up @@ -246,17 +246,6 @@ function clamp(v: number) {
}


/**
* Returns the current timestamp either based on the performance global or a date object.
*/
function now() {
if (typeof performance !== 'undefined' && performance.now) {
return performance.now();
}
return Date.now();
}


/**
* Converts Polar coordinates to Cartesian.
*/
Expand Down

0 comments on commit 14c1765

Please sign in to comment.