The ScreenOrientation interface of the the Screen Orientation API provides information about the current orientation of the document.

Documentation ScreenOrientation by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See also:

Variables

read onlyangle:Int

Returns the document's current orientation angle.

onchange:Function

Fired whenever is the EventHandler called when the screen changes orientation.

read onlytype:OrientationType

Returns the document's current orientation type, one of "portrait-primary", "portrait-secondary", "landscape-primary", or "landscape-secondary".

Methods

lock(orientation:OrientationLockType):Promise<Void>

Locks the orientation of the containing document to its default orientation and returns a Promise

Throws:

null

DOMError

unlock():Void

Unlocks the orientation of the containing document from its default orientation.

Throws:

null

DOMError

Inherited Variables

Inherited Methods

Defined by EventTarget

addEventListener(type:String, listener:Function, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

addEventListener(type:String, listener:EventListener, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

Register an event handler of a specific event type on the EventTarget.

Throws:

null

DOMError

dispatchEvent(event:Event):Bool

Dispatch an event to this EventTarget.

Throws:

null

DOMError

removeEventListener(type:String, listener:Function, ?options:EitherType<EventListenerOptions, Bool>):Void

removeEventListener(type:String, listener:EventListener, ?options:EitherType<EventListenerOptions, Bool>):Void

Removes an event listener from the EventTarget.

Throws:

null

DOMError