-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
_performance.getEntriesByType is not a function #16
Comments
@pirple-author Could I get some feedback on this? If this is not a significant problem, I would at least like to know this for my own ongoing development. Thank you! |
@rickhallett i'm having the same problem, how did you resolved this? |
@rbezerra It depends on exactly what you are trying to do with it, but essentially you need to switch to the newer versions of Node's performance API. I'm pretty disappointed that the author of a premium course didn't take the time to respond to this issue. |
@rickhallett @rbezerra Use this code before gather all measurements.
|
Try this before gather all measurements.
Entire _tokens.post handler looks like
|
Hi, Add below dependencies And add the below code before "// Gathering all the measurements" // Log out all the measurements This solution worked for me :) I hope this works for you too. |
@Juzzmart great job, your solution is almost 100% complete, because your solution shows just the total duration, while we need to show all measurements with their duration. Solution: 1 - ADD TO DEPENDENCIES SECTION (ON TOP OF FILE), we need to use an observer to collect the measures, so we need to require it.
2 - ADD BEFORE // Gather all the measures
3 - REMOVE THE OLD //Log out all the measurements, which is under all _performance.measure(...). It is no longer necessary anymore, because we are using the new one on top of all measurements. // Log out all the measurements It is gonna work exactly how it is in the course. You can check the file here: Thank you all !!!!! |
Hi @akoshevoi, I think we can make PerformanceObserver instantiated once only. Otherwise we got multiple observers to monitor performance logs when other requests sent in. Btw, thanks for your answer! |
Thanks for such a great course; I think its one of the best Node courses currently available.
I'm a fan of reading source code unguided and so I have spent some hours going into the FINAL version of the project available in Section 7. The program was bailing out with a silent fatal crash and it took me some time to work out why; in subsequent versions of Node,
performance.getEntriesByType
was moved to a different cssperformanceObserverEntryList.getEntriesByType(type)
(see v11.x docs).As this course is still current my suggestion would be to add some Node version checking code that conditionally loads these classes/methods so that other students don't run into the same error. I would be happy to submit a PR with the necessary changes.
The text was updated successfully, but these errors were encountered: