Skip to content

Conversation

@patrickhulce
Copy link
Contributor

fixes #18 or at least one possible solution :)

if (
perf &&
perf.mark &&
perf.getEntriesByName &&

Choose a reason for hiding this comment

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

It's probably enough to stop after getEntriesByName. See https://developer.mozilla.org/en-US/docs/Web/API/Performance vs https://nodejs.org/api/perf_hooks.html

Another solution is to higher up and not try to bind to the performance global if the environment is Node.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's probably enough to stop after getEntriesByName. See https://developer.mozilla.org/en-US/docs/Web/API/Performance vs https://nodejs.org/api/perf_hooks.html

It's enough right now ;)

Another solution is to higher up and not try to bind to the performance global if the environment is Node.

Sure, I don't have a preference for how @nolanlawson would like to have it fixed so long as it is fixed :)

Choose a reason for hiding this comment

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

It's enough right now ;)

It's a stable API on both sides, so there's no good reason it would change. But I can't say that checking for every method is wrong, either ;)

Copy link
Owner

Choose a reason for hiding this comment

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

I'm fine with checking for every single method. This ensure that some version of Node in the future or some other JS environment doesn't have a similar error. :)

@nolanlawson
Copy link
Owner

Thanks a lot!

@nolanlawson nolanlawson merged commit 98eebea into nolanlawson:master May 1, 2021
@nolanlawson
Copy link
Owner

Released in marky v1.2.2

@patrickhulce
Copy link
Contributor Author

Hurray! Thanks for the swift action and release here @nolanlawson :)

@patrickhulce patrickhulce deleted the patch-1 branch May 1, 2021 19:27
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.

Does not work in node 16, TypeError: perf.getEntriesByName is not a function

3 participants