pixi.js
    Preparing search index...

    Variable DOMAdapterConst Advanced

    DOMAdapter: { get(): Adapter; set(adapter: Adapter): void } = ...

    The DOMAdapter is a singleton that allows PixiJS to perform DOM operations, such as creating a canvas. This allows PixiJS to be used in any environment, such as a web browser, Web Worker, or Node.js. It uses the Adapter interface to abstract away the differences between these environments and uses the BrowserAdapter by default.

    It has two methods: get():Adapter and set(adapter: Adapter).

    Defaults to the BrowserAdapter.

    Type declaration

    • get: function
      • Returns the current adapter.

        Returns Adapter

        The current adapter.

    • set: function
      • Sets the current adapter.

        Parameters

        Returns void

    import { DOMAdapter, WebWorkerAdapter } from 'pixi.js';

    // WebWorkerAdapter is an implementation of the Adapter interface
    DOMAdapter.set(WebWorkerAdapter);

    // use the adapter to create a canvas (in this case an OffscreenCanvas)
    DOMAdapter.get().createCanvas(800, 600);