JSFiddle - React, Tailwind, and code Playground

HTML

<html>
  <body>
    <button onclick="clickme();">button</button>
  </body>
</html>

JavaScript

let keepAlive;
function clickme() {
  keepAlive = navigator.mediaDevices.getDisplayMedia({video: {displaySurface: {ideal: 'monitor'}}});
};