For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.
Interface ScreenOrientation
angle: number;
onchange: ((this: ScreenOrientation, ev: Event) => any) | null;
type: OrientationType;
addEventListener<K extends "change">(
type: K,
listener: (
this: ScreenOrientation,
ev: ScreenOrientationEventMap[K],
) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
dispatchEvent(event: Event): boolean;
lock(orientation: OrientationLockType): Promise<void>;
removeEventListener<K extends "change">(
type: K,
listener: (
this: ScreenOrientation,
ev: ScreenOrientationEventMap[K],
) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
unlock(): void;
}
Hierarchy
- EventTarget
- ScreenOrientation
Properties
Readonlyangle
The angle read-only property of the ScreenOrientation interface returns the document's current orientation angle.
onchange
Readonlytype
The type read-only property of the ScreenOrientation interface returns the document's current orientation type, one of portrait-primary, portrait-secondary, landscape-primary, or landscape-secondary.
Methods
addEventListener
-
addEventListener<K extends "change">(
type: K,
listener: (
this: ScreenOrientation,
ev: ScreenOrientationEventMap[K],
) => any,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Type Parameters
- K extends "change"
Parameters
- type: K
- listener: (this: ScreenOrientation, ev: ScreenOrientationEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
-
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
dispatchEvent
-
The
dispatchEvent()method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().Parameters
- event: Event
Returns boolean
lock
-
The
lock()method of the ScreenOrientation interface locks the orientation of the containing document to the specified orientation.Parameters
- orientation: OrientationLockType
Returns Promise<void>
removeEventListener
-
removeEventListener<K extends "change">(
type: K,
listener: (
this: ScreenOrientation,
ev: ScreenOrientationEventMap[K],
) => any,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.Type Parameters
- K extends "change"
Parameters
- type: K
- listener: (this: ScreenOrientation, ev: ScreenOrientationEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
-
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
unlock
-
The
unlock()method of the ScreenOrientation interface unlocks the orientation of the containing document, effectively locking it to the default screen orientation.Returns void
The
ScreenOrientationinterface of the Screen Orientation API provides information about the current orientation of the document.MDN Reference