kaios-types
    Preparing search index...

    Interface DOMCursor

    DOMCursor extends DOMRequest for iterating over a collection of results. Used for database queries and collection traversal.

    const cursor = navigator.mozContacts.find({});
    cursor.onsuccess = () => {
    if (!cursor.done) {
    console.log('Contact:', cursor.result);
    cursor.continue();
    }
    };
    interface DOMCursor {
        done: boolean;
        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;
        continue(): 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

    done: boolean

    Indicates whether there are more results to iterate over.

    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

    • Continues iteration to the next result.

      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