Skip to content
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

Add Clock support in node #10732

Merged
merged 2 commits into from
Feb 17, 2017
Merged

Add Clock support in node #10732

merged 2 commits into from
Feb 17, 2017

Conversation

sasha240100
Copy link
Contributor

This pull request is based on issue #8112
Current usage of ( performance || Date ).now() breaks node.js with the following error:

ReferenceError: performance is not defined

I suggest the use of ( typeof performance === 'undefined' ? Date : performance ).now(). It works in node.js environment as expected.

@@ -18,7 +18,7 @@ Object.assign( Clock.prototype, {

start: function () {

this.startTime = ( performance || Date ).now();
this.startTime = ( typeof performance === 'undefined' ? Date : performance ).now();
Copy link
Collaborator

@Mugen87 Mugen87 Feb 5, 2017

Choose a reason for hiding this comment

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

Can you please add a comment in the respective lines? Something like // see #10732

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Mugen87 Will do now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Mugen87 Done

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 5, 2017

I don't now why, but the format of the comment looks strange. Maybe like this? 😉

this.startTime = ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732

@sasha240100
Copy link
Contributor Author

@Mugen87 I added this one first, then looked to other comments to follow your code style and moved to line before, lol. Will update that again now

@sasha240100
Copy link
Contributor Author

@Mugen87 I reimplemented that commit. See now

@sasha240100
Copy link
Contributor Author

@mrdoob @Mugen87 Anything else?

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 5, 2017

Looks good!

@sasha240100
Copy link
Contributor Author

@Mugen87 @mrdoob Will it be merged?

@sasha240100
Copy link
Contributor Author

@Mugen87 @mrdoob is it still of current interest?

@sasha240100
Copy link
Contributor Author

Or should i close it?

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 17, 2017

It's still a valid PR but I'm unable to merge. Let's wait what @mrdoob says...

@mrdoob
Copy link
Owner

mrdoob commented Feb 17, 2017

Looks good indeed! (Sorry for the delay!)

@mrdoob mrdoob merged commit 8e4507d into mrdoob:dev Feb 17, 2017
@mrdoob
Copy link
Owner

mrdoob commented Feb 17, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants