kaios-types
    Preparing search index...

    Interface DOMRequest

    DOMRequest represents an asynchronous operation in the KaiOS/B2G platform. It provides a promise-like interface for handling success and error callbacks.

    const request: DOMRequest = navigator.mozSettings.createLock().get('wifi.enabled');
    request.onsuccess = () => {
    console.log('Setting value:', request.result);
    };
    request.onerror = () => {
    console.error('Error:', request.error);
    };
    interface DOMRequest {
        error: any;
        onerror: ((this: DOMRequest, ev: Event) => any) | null;
        onsuccess: ((this: DOMRequest, ev: Event) => any) | null;
        readyState: "pending" | "done";
        result: any;
        addEventListener(
            type: string,
            callback: EventListenerOrEventListenerObject | null,
            options?: boolean | AddEventListenerOptions,
        ): void;
        dispatchEvent(event: Event): boolean;
        removeEventListener(
            type: string,
            callback: EventListenerOrEventListenerObject | null,
            options?: boolean | EventListenerOptions,
        ): void;
        then(
            onSuccess?: (value: any) => any,
            onError?: (reason: any) => any,
        ): Promise<any>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    error: any

    Error object when the request fails.

    onerror: ((this: DOMRequest, ev: Event) => any) | null

    Event handler called when the request fails.

    onsuccess: ((this: DOMRequest, ev: Event) => any) | null

    Event handler called when the request completes successfully.

    readyState: "pending" | "done"

    Current state of the request.

    result: any

    The result value when the request succeeds.

    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

      Parameters

      • type: string
      • callback: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | AddEventListenerOptions

      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

      Parameters

      • type: string
      • callback: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | EventListenerOptions

      Returns void

    • Promise-like interface for handling success and error.

      Parameters

      • OptionalonSuccess: (value: any) => any

        Callback invoked on success

      • OptionalonError: (reason: any) => any

        Callback invoked on error

      Returns Promise<any>

      A Promise