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

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

MDN Reference

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;
    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
Index

Properties

angle: number

The angle read-only property of the angle.

MDN Reference

onchange: ((this: ScreenOrientation, ev: Event) => any) | null

The type read-only property of the type, one of portrait-primary, portrait-secondary, landscape-primary, or landscape-secondary.

MDN Reference

Methods

  • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

    MDN Reference

    Type Parameters

    • K extends "change"

    Parameters

    Returns void

  • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

    MDN Reference

    Parameters

    Returns void

  • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.

    MDN Reference

    Parameters

    • event: Event

    Returns boolean

  • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.

    MDN Reference

    Type Parameters

    • K extends "change"

    Parameters

    Returns void

  • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.

    MDN Reference

    Parameters

    Returns void

  • The unlock() method of the document from its default orientation.

    MDN Reference

    Returns void

Was this helpful?