Trait for objects that need to handle rendering context loss and restoration.

interface RenderingContextHandler {
    onRenderingContextLost(options: {
        canvas: HTMLCanvasElement;
    }): void;
    onRenderingContextRestored(options: {
        canvas: HTMLCanvasElement;
    }): void;
}

Implemented by

Methods

  • Called when the rendering context has been lost.

    Parameters

    • options: {
          canvas: HTMLCanvasElement;
      }

      The options.

      • canvas: HTMLCanvasElement

        The canvas holding the restored rendering context.

    Returns void

  • Called when the rendering context has been restored.

    Parameters

    • options: {
          canvas: HTMLCanvasElement;
      }

      The options.

      • canvas: HTMLCanvasElement

        The canvas holding the restored rendering context.

    Returns void