The Performance APIs come directly from the browsers, so there is no need to import anything if you want to use them. Here's an example from MDN:
function print_nav_timing_data() {
// Use getEntriesByType() to only get the "navigation" events
var perfEntries = performance.getEntriesByType("navigation");
for (var i=0; i < perfEntries.length; i++) {
console.log("= Navigation entry[" + i + "]");
var p = perfEntries[i];
// DOM Properties
console.log("DOM content loaded = " + (p.domContentLoadedEventEnd - p.domContentLoadedEventStart));
console.log("DOM complete = " + p.domComplete);
console.log("DOM interactive = " + p.domInteractive);
// document load and unload time
console.log("document load = " + (p.loadEventEnd - p.loadEventStart));
console.log("document unload = " + (p.unloadEventEnd - p.unloadEventStart));
// other properties
console.log("type = " + p.type);
console.log("redirectCount = " + p.redirectCount);
}
}
If you're primarily interested in measuring these specific metrics, you can use the web-vitals project provided by Google here. The usage is as follows:
import {getFCP} from 'web-vitals';
// Measure and log the current FCP value,
// whenever it's ready to be reported.
getFCP(console.log);
Since the source code is available, you can also see how they utilize the APIs.