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

getEntriesByName is Deprecated in Node 10 #1

Open
codeNameAtlas opened this issue Aug 31, 2018 · 3 comments
Open

getEntriesByName is Deprecated in Node 10 #1

codeNameAtlas opened this issue Aug 31, 2018 · 3 comments

Comments

@codeNameAtlas
Copy link

Hey @stevekinney,

Really enjoying your course on FE Masters. As an fyi, the getEntriesByName method does not exist in version 10 of node. GH issue here.

I was not able to get things working with this new object, but was able to force a work around by using node 9.8.0. Everything appears to work so far on that version of node.

@gargrave
Copy link

gargrave commented Sep 8, 2018

I am experiencing this as well. Using the docs here, I was able to get it working in Node 10.6.0 like so. (The only actual changes are the import, and then the last 7 lines.)

@stevekinney I can submit a PR if that would help.

const { performance, PerformanceObserver } = require('perf_hooks');

// SETUP 🏁

let iterations = 1e7;

const a = 1;
const b = 2;

const add = (x, y) => x + y;

// 🔚 SETUP

performance.mark('start');

// EXERCISE 💪

while (iterations--) {
  add(a, b);
}

// 🔚 EXERCISE

performance.mark('end');

const obs = new PerformanceObserver((list, observer) => {
  console.log(list.getEntries()[0]);
  performance.clearMarks();
  observer.disconnect();
});
obs.observe({ entryTypes: ['measure'] });
performance.measure('My Special Benchmark', 'start', 'end');

@1Marc
Copy link
Collaborator

1Marc commented Dec 9, 2018

@gargrave a PR would be amazing. But thanks for posting this!

@josepex
Copy link

josepex commented Mar 29, 2019

@gargrave Thanks man !

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

No branches or pull requests

4 participants