-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Add Clock support in node #10732
Conversation
src/core/Clock.js
Outdated
@@ -18,7 18,7 @@ Object.assign( Clock.prototype, { | |||
|
|||
start: function () { | |||
|
|||
this.startTime = ( performance || Date ).now(); | |||
this.startTime = ( typeof performance === 'undefined' ? Date : performance ).now(); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mugen87 Will do now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mugen87 Done
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 |
@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 |
@Mugen87 I reimplemented that commit. See now |
Looks good! |
Or should i close it? |
It's still a valid PR but I'm unable to merge. Let's wait what @mrdoob says... |
Looks good indeed! (Sorry for the delay!) |
Thanks! |
This pull request is based on issue #8112
Current usage of
( performance || Date ).now()
breaks node.js with the following error:I suggest the use of
( typeof performance === 'undefined' ? Date : performance ).now()
. It works in node.js environment as expected.