Chartbreaker
    Preparing search index...

    Interface OffscreenCanvas

    When using the canvas element or the Canvas API, rendering, animation, and user interaction usually happen on the main execution thread of a web application.

    MDN Reference

    interface OffscreenCanvas {
        height: number;
        oncontextlost: null | ((this: OffscreenCanvas, ev: Event) => any);
        oncontextrestored: null | ((this: OffscreenCanvas, ev: Event) => any);
        width: number;
        addEventListener<K extends keyof OffscreenCanvasEventMap>(
            type: K,
            listener: (this: OffscreenCanvas, ev: OffscreenCanvasEventMap[K]) => any,
            options?: boolean | AddEventListenerOptions,
        ): void;
        addEventListener(
            type: string,
            listener: EventListenerOrEventListenerObject,
            options?: boolean | AddEventListenerOptions,
        ): void;
        convertToBlob(options?: ImageEncodeOptions): Promise<Blob>;
        dispatchEvent(event: Event): boolean;
        getContext(
            contextId: "2d",
            options?: any,
        ): null | OffscreenCanvasRenderingContext2D;
        getContext(
            contextId: "bitmaprenderer",
            options?: any,
        ): null | ImageBitmapRenderingContext;
        getContext(contextId: "webgl", options?: any): null | WebGLRenderingContext;
        getContext(
            contextId: "webgl2",
            options?: any,
        ): null | WebGL2RenderingContext;
        getContext(
            contextId: OffscreenRenderingContextId,
            options?: any,
        ): null | OffscreenRenderingContext;
        removeEventListener<K extends keyof OffscreenCanvasEventMap>(
            type: K,
            listener: (this: OffscreenCanvas, ev: OffscreenCanvasEventMap[K]) => any,
            options?: boolean | EventListenerOptions,
        ): void;
        removeEventListener(
            type: string,
            listener: EventListenerOrEventListenerObject,
            options?: boolean | EventListenerOptions,
        ): void;
        transferToImageBitmap(): ImageBitmap;
    }

    Hierarchy

    • EventTarget
      • OffscreenCanvas
    Index

    Properties

    height: number

    The height property returns and sets the height of an OffscreenCanvas object.

    MDN Reference

    oncontextlost: null | ((this: OffscreenCanvas, ev: Event) => any)
    oncontextrestored: null | ((this: OffscreenCanvas, ev: Event) => any)
    width: number

    The width property returns and sets the width of an OffscreenCanvas object.

    MDN Reference

    Methods

    • The OffscreenCanvas.convertToBlob() method creates a Blob object representing the image contained in the canvas.

      MDN Reference

      Parameters

      Returns Promise<Blob>

    • 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 OffscreenCanvas.transferToImageBitmap() method creates an ImageBitmap object from the most recently rendered image of the OffscreenCanvas.

      MDN Reference

      Returns ImageBitmap