npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@semibold/fullscreen

v3.1.0

Published

JavaScript Fullscreen API. Support different frames(documents)

Downloads

34

Readme

Fullscreen

Changelog

Modern JavaScript Fullscreen API. Just for browser.

Install

Source code is written by TypeScript.

$ npm i @semibold/fullscreen

Usage

// Global
// <script src="./dist/release/fullscreen.js"></script>

// NodeJS Module
const { Fullscreen } = require("@semibold/fullscreen");

// ES-next Module
import { Fullscreen } from "@semibold/fullscreen";

Support

More Information: Can I Use Fullscreen?

Instance & API

/**
 * @param {Element} target - target element
 */
const fs = new Fullscreen(target);

/**
 * @typedef {Object} Metadata
 * @property {string} name
 * @property {string} version
 * @property {string} revision
 * @property {boolean} production
 * @property {string} lastCompiled
 * @return {Metadata}
 */
Fullscreen.metadata;

/**
 * @return {Element} - get current target element
 */
fs.currentElement;

/**
 * @return {FullscreenAPIMapping | null}
 */
fs.fullscreenMapping;

/**
 * @desc The `fullscreenEnabled` attribute tells you whether or not the document is
 *       currently in a state that would allow fullscreen mode to be requested.
 *
 * @return {boolean}
 */
fs.fullscreenEnabled;

/**
 * @desc The `fullscreenElement` attribute tells you the element that's currently being
 *       displayed fullscreen. If this is non-null, the document is in fullscreen mode.
 *       If this is null, the document is not in fullscreen mode.
 *
 * @return {Element | null}
 */
fs.fullscreenElement;

/**
 * @desc Return BrowsingContextPromise
 *
 * @return {PromiseConstructor | null}
 */
fs.getBrowsingContextPromise();

/**
 * @desc The `fs.requestFullscreen()` method issues an asynchronous request to make
 *       the target be displayed full-screen.
 * @desc It will always return promise if BrowsingContextPromise is available.
 *
 * @param {Object} [options]
 * @param {"auto" | "show" | "hide"} [options.navigationUI]
 *
 * @return {Promise<void> | void}
 */
fs.requestFullscreen(options);

/**
 * @desc The `fs.exitFullscreen()` is a method that takes the target out of
 *       full-screen mode.
 * @desc It will always return promise if BrowsingContextPromise is available.
 *
 * @param {boolean} [isBrowsingContext]
 * @desc `fs.exitFullscreen()` does nothing if `document.fullscreenElement !== target`.
 * @desc `fs.exitFullscreen(true)` equal to `docuemnt.exitFullscreen()`.
 *
 * @return {Promise<void> | void}
 */
fs.exitFullscreen(isBrowsingContext);

/**
 * @desc Needn't to add prefix to the `type`
 * @desc The `fullscreenchange` event is fired when the document is switched to/out-of
 *       fullscreen mode.
 * @desc The fullscreenerror event is fired when the document cannot switch to fullscreen
 *       mode.
 *
 * @param {FullscreenEventType} type - "fullscreenchange" | "fullscreenerror"
 * @param {EventListenerOrEventListenerObject} listener
 * @param {boolean | AddEventListenerOptions} [options]
 *
 * @deprecated Use returned promise if BrowsingContextPromise is available.
 */
fs.addListener(type, listener, options);

/**
 * @desc Needn't to add prefix to the `type`
 * @desc Similar to `fs.addEventListener(type, listener, options)`
 *
 * @param {FullscreenEventType} type - "fullscreenchange" | "fullscreenerror"
 * @param {EventListenerOrEventListenerObject} listener
 * @param {boolean | EventListenerOptions} [options]
 *
 * @deprecated Use returned promise if BrowsingContextPromise is available.
 */
fs.removeListener(type, listener, options);

Example

const fs = new Fullscreen(document.body);

function onFullscreenChange(e) {
    console.log("fullscreenchange event triggered");
}

if (fs.fullscreenEnabled) {
    console.log(fs.currentElement === document.body); // log: true

    fs.addListener("fullscreenchange", onFullscreenChange);
    fs.requestFullscreen(); // triggered by gesture

    if (fs.getBrowsingContextPromise()) {
        fs.exitFullscreen()
            .then(() => {
                console.log("Everything is ok.");
            })
            .catch(err => {
                if (err) {
                    console.warn(err);
                } else {
                    alert("Cannot exit fullscreen mode.");
                }
            });
    }
}

Non-public API

/**
 * @desc Be Careful: these methods only support a handful of the latest browsers.
 *
 * @desc Equal to `Element.onfullscreenchange` and `Element.onfullscreenerror`
 * @desc Equal to `Element.addEventListener` and `Element.removeEventListener`
 *
 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/onfullscreenchange
 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/onfullscreenerror
 */
fs.onfullscreenchange;
fs.onfullscreenerror;
fs.addEventListener(type, listener, options);
fs.removeEventListener(type, listener, options);

FAQ

  • Should I use deprecated method(fs.addListener/fs.removeListener)?
    • You should use these method if BrowsingContextPromise is unavailable .
  • Why remove fs.toggleFullscreen method?
    • Because this method isn't reliable if browser support options of fs.requestFullscreen(options).
  • Can I use non-public methods(fs.addEventListener/fs.removeEventListener/...)?
    • It depends on you. These methods only support a handful of the latest browsers.

Reference