Socket
Socket
Sign inDemoInstall

fullscreen

Package Overview
Dependencies
1
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fullscreen

fullscreen polyfill api that presents an event emitter


Version published
Weekly downloads
851
decreased by-2.96%
Maintainers
2
Install size
11.6 kB
Created
Weekly downloads
 

Readme

Source

fullscreen

polyfill for requestFullscreen


var fullscreen = require('fullscreen')
  , el = document.getElementById('element')
  , fs

fs = fullscreen(el)

el.addEventListener('click', function() {
  fs.request()
})

document.body.onkeydown = function() {
  fs.release()
}

fs.on('attain', function() {
  // attained fullscreen
})

fs.on('release', function() {
  // released fullscreen
})

fs.on('error', function() {
  // fullscreen request failed, or
  // fullscreen isn't supported
})

API

require('fullscreen').available() -> bool

return a boolean yes/no for whether fullscreen api is supported.

require('fullscreen').enabled() -> bool

return a boolean yes/no for whether fullscreen is enabled for the document.

fullscreen(element) -> fs event emitter

return a fullscreen event emitter object. if fullscreen is not available, on the next turn of the event loop it'll emit 'error'.

fs.request() -> undefined

issue a request for fullscreen. if it's accepted, it emits 'attain', otherwise 'error' for denial.

fs.release() -> undefined

release the current fullscreen element. if the fullscreen is released, it emits 'release'.

fs.dispose() -> undefined

removes any event listeners created by the fs instance once you're done with it.

fs.target() -> HTMLElement?

returns the current fullscreen target, if any.

License

MIT

Keywords

FAQs

Last updated on 02 Sep 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc