@jswork/fullscreen
v1.1.2
Published
Fullscreen API.
Downloads
26
Readme
fullscreen
Fullscreen API.
installation
npm install @jswork/fullscreen
usage
import fullscreen from '@jswork/fullscreen';
// enter fullscreen
fullscreen.request()
// exit fullscreen
fullscreen.exit()
// toggle fullscreen
fullscreen.toggle()
// register event
const res = fullscreen.on((e)=>console.log(e));
// unregister event
res.destroy();
// detect fullscreen status
fullscreen.isFullscreen
in html
<button id="p1">Request Fullscreen</button>
<button id="p2">Exit Fullscreen</button>
<script>
const el1 = document.getElementById('p1');
const el2 = document.getElementById('p2');
el1.addEventListener('click', () => {
fullscreen.request();
});
el2.addEventListener('click', () => {
fullscreen.exit();
});
</script>
types
/// <reference types="@jswork/fullscreen/global.d.ts" />
license
Code released under the MIT license.