WHATWG Fullscreen API Fallback
I suggest you to use jspm as your package manager.
import Fullscreen from "jsfullscreen";
const fullscreen = new Fullscreen(document.body);
fullscreen.on("change", (isActive) => {
console.log(`fullscreen is ${isActive ? 'active' : 'not active'}`);
});
fullscreen.element.addEventListener("click", () => {
fullscreen.requestFullscreen();
});
Please checkout the index-dist.html file for direct usage in a browser.
- Fullscreen
- Constructor(Element element) extends EventEmitter
- Members
- requestFullscreen() => Promise
- Static Members
- exitFullscreen() => Promise
- Properties
- element => Element
- isActive => Boolean
- Static Properties
- fullscreenElement => Element
- isSupported / fullscreenEnabled => Boolean
- Events
- change / fullscreenchange => (Boolean isActive, Event e)
- error / fullscreenerror => (Error err, Event e)
- unsupported => ()