JSFiddle - React, Tailwind, and code Playground
HTML
<div id="result"></div>
<div id="heap_size_limit"></div>
<div id="total_heap_size"></div>
<div id="used_heap_size"></div>
JavaScript
window.onload = function()
{
if("performance" in window)
{
if("memory" in window.performance)
{
document.getElementById("result").innerHTML = "Page Performance API and Memory Profiling API is supported";
document.getElementById("heap_size_limit").innerHTML = "Heap size limit: " + window.performance.memory.jsHeapSizeLimit + " kb";
document.getElementById("total_heap_size").innerHTML = "Total heap size of this page: " + window.performance.memory.totalJSHeapSize + " bytes";
document.getElementById("used_heap_size").innerHTML = "Used heap size: " + window.performance.memory.usedJSHeapSize + " bytes";
}
else
{
document.getElementById("result").innerHTML = "Memory Profiling API is not supported by this browser";
}
}
else
{
document.getElementById("result").innerHTML = "Page Performance API is not supported";
}
}