FullscreenManager

Handling fullscreen requests can be a little complex so it gets its own class

Author
  • Mark Mayes / mm-dev
License
  • GPL-3.0-only

Methods

(static) init(_ob)

Source
Initialise the manager
Parameters
Name Type Description
_ob object
Name Type Description
userPrefersFullscreen boolean

Used to keep track of user preference during this session

(static) setState(_ob)

Source
Enter or exit fullscreen mode
Parameters
Name Type Description
_ob object
Name Type Description
userInitiated boolean

true if the user specifically asked for this state (eg by clicking the icon), used to remember their preference and override any future requests by the app if they go against the preference

wantsFullscreen boolean

true if calling for fullscreen, false if wanting to exit fullscreen

el HTMLElement

The element to try to make fullscreen

(static) tryMethodCall(_target_el, _methodName, _description)

Source
Try calling a method to set a DOM element to fullscreen

Different browsers use different methods to go fullscreen, so we may need to try a few before something works.

Parameters
Name Type Description
_target_el HTMLElement
_methodName string

The method to try

_description string

Used in any error messages produced during this attempt