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

ember-fullscreen

v1.0.5

Published

Fullscreen API packaged as an Ember service.

Downloads

6,153

Readme

ember-fullscreen

Ember Observer Score npm version

Fullscreen API packaged as an Ember service.

ember-fullscreen uses Screenfull for the all the Fullscreen API calls. This means that ember-fullscreen will work on every browser that supports fullscreen API/screenfull: http://caniuse.com/fullscreen

Check minimal demo.

Installation

ember-fullscreen is an ember-cli addon. Just run the install command on your ember-cli project:

ember install ember-fullscreen

For more information on using ember-cli, visit http://www.ember-cli.com/.

Usage

Inject the service anywhere you need it by adding fullscreen: Ember.inject.service(). The fullscreen service has the following properties and methods:

  • .isAvailable - A boolean that represents whether you are allowed to enter fullscreen.

  • .isEnabled - A boolean that represents whether you are in fullscreen mode.

  • .enable() - Enters fullscreen mode. Accepts a DOM element. Default is <html>. If called with another element than the currently active, it will switch to that if it's a decendant. Yes, you can make DOM elements fullscreen.

  • .disable() - Disables fullscreen mode.

  • .toggle() - Enables fullscreen mode if not active, disables if active. Also accepts an optional DOM element.

  • .on('error', ...) - Fullscreen service includes Ember.Evented mixin. When a fullscreen request fails, ember-fullscreen triggers an error event.

  • .on('fullscreenChange', ...) - When the fullscreen state changes, ember-fullscreen notifies the new isEnabled state.

Examples

Create a button in your controller with an action that toggles fullscreen mode:

export default Controller.extend({
  fullscreen: service(),
  actions: {
    toggleFullscreen() {
      this.get('fullscreen').toggle();
    }
  }
});

Use it on your templates to conditionally render depending on a boolean:

{{#if fullscreen.isEnabled}}
  I'm fullscreen
{{else}}
  I'm NOT fullscreen
{{/if}}

Only display a button to enter fullscreen if the browser supports it:

{{#if fullscreen.isAvailable}}
  <button onclick={{action "toggleFullscreen"}}>
    Toggle fullscreen
  </button>
{{/if}}

A simple component that sets its own element to fullscreen on click:

export default Component.extend({
  fullscreen: service(),
  click() {
    this.get('fullscreen').toggle(this.element);
  }
});

Bind an icon class depending on wether we're in fullscreen:

{{!-- Uses font-awesome --}}
<i class="{{if fullscreen.isEnabled "fa-compress" "fa-expand"}}"></i>