JSFiddle - React, Tailwind, and code Playground

by Michael Barros

HTML

<script id="worker-code" type="dont/run">
  setInterval(function() { postMessage(''); }, 1000 / 50);
</script>

open devtools console as a separate window and inactive this tab, fps should remain same when tab is active or inactive.

JavaScript

var blob = new Blob([document.querySelector('#worker-code').textContent]);
var worker = new Worker(window.URL.createObjectURL(blob));
var t1 = 0;
worker.onmessage = function() {
	var t2 = new Date().getTime();
	console.debug('fps =', 1000 / (t2 - t1) | 0);
  t1 = t2;
}