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 🙏

© 2024 – Pkg Stats / Ryan Hefner

fullscrn

v1.3.8

Published

Fullscreen API

Downloads

32

Readme

Fullscrn

Fullscreen API. This module injects APIs to the DOM. So, you don't have to consider about the prefix such as 'moz' or 'webkit'.

The implementation follows the standard specification at Fullscreen API - WHATWG.

See also this project page.

INSTALLATION

$ npm install --save fullscrn

REPOSITORY

FILES

  • fullscrn.js - The script to include by script tag.
  • fullscrn.min.js - Minified one.
  • index.js - The source file of this module. This can be import using browserify.

APIs Injected to DOM

Properties

  • Document.fullscreenEnabled - The full screen API's availability.
  • Document.fullscreenElement - Indicates the full sized element.
  • Document.fullscreen - The equivalent value to (Document.fullscreenElement != null).

Methods

These methods returns promise.

  • Element.requestFullscreen() - Requests the fullscreen mode with the element.
  • Document.exitFullscreen() - Cancels the fullscreen mode of the element that is set to fullscreen at the time.

Events

Use document.addEventListener to handle events while this module does not supoort the event handlers - Document.onfullscreenchange and onfullscreenerror.

  • Document "fullscreenchange"
  • Document "fullscreenerror"

SAMPLE

sample/injected.html [live sample].

<body onload="main();">
    <button type="button" onclick="request1();"
    >Full&gt;&gt;</button>
    <span id="panel">
        <button type="button" onclick="request2();"
        >Full&gt;&gt;</button>
        <button type="button" id="exitButton"
        onclick="exit();">&lt;&lt;Exit</button>
    </span>
    <script src="../fullscrn.js"></script>
    <script>
        var panel = document.getElementById("panel");
        var exitButton = document.getElementById("exitButton");
        Fullscreen.debugMode(true);// Enables debug log
        function main() {
            // Handle change event
            document.addEventListener("fullscreenchange",
                function() {
                    var fse = document.fullscreenElement;
                    console.log("FULLSCREEN CHANGE: " +
                        ((fse == null)? "(null)": "#" + fse.id));
                });

            // Handle error event
            document.addEventListener("fullscreenerror",
                function() { console.log("FULLSCREEN ERROR"); });

            request1(); // This should be error
        }
        function request1() {
            panel.requestFullscreen().then(function(){
                console.log("request1 done.");
            }).catch(function(err) {
                console.error(err.message);
            });
        }
        function request2() {
            exitButton.requestFullscreen().then(function(){
                console.log("request2 done.");
            }).catch(function(err) {
                console.error(err.message);
            });
        }
        function exit() {
            document.exitFullscreen()
            .then(function(){
                console.log("exit done.");
            }).catch(function(err) {
                console.error(err.message);
            });
        }
    </script>
</body>

Exported APIs

If this module was included by script tag, the global object 'Fullscreen' is available (see the sample/sample.html below).

Properties

  • Fullscreen.enabled - indicates the fullscreen APIs are available.
  • Fullscreen.element - references the fullscreen element or null.

Methods

  • Fullscreen.request(element) - enter full screen mode with the element and returns a promise.
  • Fullscreen.exit(): exit full screen mode and returns a promise.

SAMPLE

sample/sample.html [live sample].

<body>
    <button type="button"
        onclick="requestFull();">Fullscreen</button>
    <button type="button" id="exitButton"
         style="display:none;"
         onclick="exitFull();">Exit</button>
    <script src="../fullscrn.js"></script>
    <script>
        function exitButton() {
            return document.getElementById("exitButton");
        }
        function requestFull() {
            var btn = exitButton();
            btn.style.display = "block";
            Fullscreen.request(btn);
        }
        function exitFull() {
            var btn = exitButton();
            btn.style.display = "none";
            Fullscreen.exit();
        }
    </script>
</body>

LICENSE

This software is released under the MIT License, see LICENSE