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 ActorTarget

An interface to be sent to the actor in order for it to allow communication between the worker and the main thread

interface ActorTarget {
    addEventListener: {
        <K extends keyof WindowEventMap>(
            type: K,
            listener: (this: Window, ev: WindowEventMap[K]) => any,
            options?: boolean | AddEventListenerOptions,
        ): void;
        (
            type: string,
            listener: EventListenerOrEventListenerObject,
            options?: boolean | AddEventListenerOptions,
        ): void;
    } & {
        <K extends keyof WindowEventMap>(
            type: K,
            listener: (this: Window, ev: WindowEventMap[K]) => any,
            options?: boolean | AddEventListenerOptions,
        ): void;
        (
            type: string,
            listener: EventListenerOrEventListenerObject,
            options?: boolean | AddEventListenerOptions,
        ): void;
    };
    postMessage: {
        (message: any, targetOrigin: string, transfer?: Transferable[]): void;
        (message: any, options?: WindowPostMessageOptions): void;
    } & {
        (message: any, targetOrigin: string, transfer?: Transferable[]): void;
        (message: any, options?: WindowPostMessageOptions): void;
    };
    removeEventListener: {
        <K extends keyof WindowEventMap>(
            type: K,
            listener: (this: Window, ev: WindowEventMap[K]) => any,
            options?: boolean | EventListenerOptions,
        ): void;
        (
            type: string,
            listener: EventListenerOrEventListenerObject,
            options?: boolean | EventListenerOptions,
        ): void;
    } & {
        <K extends keyof WindowEventMap>(
            type: K,
            listener: (this: Window, ev: WindowEventMap[K]) => any,
            options?: boolean | EventListenerOptions,
        ): void;
        (
            type: string,
            listener: EventListenerOrEventListenerObject,
            options?: boolean | EventListenerOptions,
        ): void;
    };
    terminate?: () => void;
}
Index

Properties

addEventListener: {
    <K extends keyof WindowEventMap>(
        type: K,
        listener: (this: Window, ev: WindowEventMap[K]) => any,
        options?: boolean | AddEventListenerOptions,
    ): void;
    (
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | AddEventListenerOptions,
    ): void;
} & {
    <K extends keyof WindowEventMap>(
        type: K,
        listener: (this: Window, ev: WindowEventMap[K]) => any,
        options?: boolean | AddEventListenerOptions,
    ): void;
    (
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | AddEventListenerOptions,
    ): void;
}

Type Declaration

    • <K extends keyof WindowEventMap>(
          type: K,
          listener: (this: Window, ev: WindowEventMap[K]) => any,
          options?: boolean | AddEventListenerOptions,
      ): 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

      Type Parameters

      Parameters

      • type: K
      • listener: (this: Window, ev: WindowEventMap[K]) => any
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • (
          type: string,
          listener: EventListenerOrEventListenerObject,
          options?: boolean | AddEventListenerOptions,
      ): 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

postMessage: {
    (message: any, targetOrigin: string, transfer?: Transferable[]): void;
    (message: any, options?: WindowPostMessageOptions): void;
} & {
    (message: any, targetOrigin: string, transfer?: Transferable[]): void;
    (message: any, options?: WindowPostMessageOptions): void;
}

Type Declaration

    • (message: any, targetOrigin: string, transfer?: Transferable[]): void
    • The window.postMessage() method safely enables cross-origin communication between Window objects; e.g., between a page and a pop-up that it spawned, or between a page and an iframe embedded within it.

      MDN Reference

      Parameters

      • message: any
      • targetOrigin: string
      • Optionaltransfer: Transferable[]

      Returns void

    • (message: any, options?: WindowPostMessageOptions): void
    • Parameters

      Returns void

    • (message: any, targetOrigin: string, transfer?: Transferable[]): void
    • The window.postMessage() method safely enables cross-origin communication between Window objects; e.g., between a page and a pop-up that it spawned, or between a page and an iframe embedded within it.

      MDN Reference

      Parameters

      • message: any
      • targetOrigin: string
      • Optionaltransfer: Transferable[]

      Returns void

    • (message: any, options?: WindowPostMessageOptions): void
    • The window.postMessage() method safely enables cross-origin communication between Window objects; e.g., between a page and a pop-up that it spawned, or between a page and an iframe embedded within it.

      MDN Reference

      Parameters

      Returns void

removeEventListener: {
    <K extends keyof WindowEventMap>(
        type: K,
        listener: (this: Window, ev: WindowEventMap[K]) => any,
        options?: boolean | EventListenerOptions,
    ): void;
    (
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | EventListenerOptions,
    ): void;
} & {
    <K extends keyof WindowEventMap>(
        type: K,
        listener: (this: Window, ev: WindowEventMap[K]) => any,
        options?: boolean | EventListenerOptions,
    ): void;
    (
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | EventListenerOptions,
    ): void;
}

Type Declaration

    • <K extends keyof WindowEventMap>(
          type: K,
          listener: (this: Window, ev: WindowEventMap[K]) => any,
          options?: boolean | EventListenerOptions,
      ): void
    • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.

      MDN Reference

      Type Parameters

      Parameters

      Returns void

    • (
          type: string,
          listener: EventListenerOrEventListenerObject,
          options?: boolean | EventListenerOptions,
      ): 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

terminate?: () => void
Was this helpful?