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
})
return a boolean yes/no for whether fullscreen api is supported.
return a fullscreen event emitter object. if fullscreen is not
available, on the next turn of the event loop it'll emit 'error'
.
issue a request for fullscreen. if it's accepted, it emits 'attain'
, otherwise 'error'
for denial.
release the current fullscreen element. if the fullscreen is released, it emits 'release'
.
returns the current fullscreen target, if any.
MIT