JSFiddle - React, Tailwind, and code Playground

by David Storey

HTML

<p id="getEntries">Is performance.getEntries supported?</p>
<p id="getEntriesByType">Is performance.getEntriesByType supported?</p>
<p id="getEntriesByName">Is performance.getEntriesByName supported?</p>

CSS

.supported {
    background-color: lime;
}
.unsupported {
    background-color: red;
}
.prefixed {
 background-color: orange;
}

JavaScript

var methods =  ["getEntries", "getEntriesByType", "getEntriesByName"];

if (window.performance) {
    for (var i = 0; i < methods.length; i++) {
        var el = document.getElementById(methods[i]);
        if (typeof window.performance[methods[i]] !== "undefined") {
            el.textContent = "performance." + methods[i] + " is supported!";
            el.className = "supported";
        } else {
            el.textContent = "performance." + methods[i] + " is not supported :(";
            el.className = "unsupported";
        }
    }
            
} else {
    console.log("Performance is not supported at all");
}