A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/contextrestored_event below:

OffscreenCanvas: contextrestored event - Web APIs

OffscreenCanvas: contextrestored event

Limited availability

The contextrestored event of the OffscreenCanvas interface is fired if the browser restores a OffscreenCanvasRenderingContext2D context that was previously lost.

You can redraw, re-retrieve resources, and reinitialize the state of your context after receiving this event.

Syntax

Use the event name in methods like addEventListener(), or set an event handler property.

addEventListener("contextrestored", (event) => { })

oncontextrestored = (event) => { }
Event type

A generic Event.

Examples

The code fragment below detects the context restored event.

const canvas = new OffscreenCanvas(256, 256);
const gl = offscreen.getContext("2d");

canvas.addEventListener(
  "contextrestored",
  (e) => {
    console.log(e);
    // call to redrawCanvas() or similar
  },
  false,
);
Specifications Browser compatibility See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4