Skip to content

fix(progress-circle): remove references to window #838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/progress-circle/progress-circle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ const DURATION_INDETERMINATE = 667;
/** Duration of the indeterminate animation. */
const DURATION_DETERMINATE = 225;
/** Start animation value of the indeterminate animation */
let startIndeterminate = 3;
const startIndeterminate = 3;
/** End animation value of the indeterminate animation */
let endIndeterminate = 80;
const endIndeterminate = 80;


export type ProgressCircleMode = 'determinate' | 'indeterminate';
Expand Down Expand Up @@ -184,7 +184,7 @@ export class MdProgressCircle implements OnDestroy {
private _startIndeterminateAnimation() {
let rotationStartPoint = 0;
let start = startIndeterminate;
let end = endIndeterminate;
let end = endIndeterminate;
let duration = DURATION_INDETERMINATE;
let animate = () => {
this._animateCircle(start, end, materialEase, duration, rotationStartPoint);
Expand Down Expand Up @@ -250,8 +250,8 @@ function clamp(v: number) {
* Returns the current timestamp either based on the performance global or a date object.
*/
function now() {
if (window.performance && window.performance.now) {
return window.performance.now();
if (typeof performance !== 'undefined' && performance.now) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to change this? It seems like change for the sake of change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of the PR was to remove the references to window. Just doing if (performance && performance.now) would throw an exception if the client doesn't have the performance object.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean what is the purpose of removing the reference to window?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, in #837 the user mentioned that there's a runtime exception when rendering server-side, because of the references to window.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I missed the linked issue. Thanks.

return performance.now();
}
return Date.now();
}
Expand Down