A RetroSearch Logo

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

Search Query:

Showing content from https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isContextLost below:

CanvasRenderingContext2D: isContextLost() method - Web APIs

CanvasRenderingContext2D: isContextLost() method

Limited availability

The CanvasRenderingContext2D.isContextLost() method of the Canvas 2D API returns true if the rendering context is lost (and has not yet been reset). This might occur due to driver crashes, running out of memory, and so on.

If the user agent detects that the canvas backing storage is lost it will fire the contextlost event at the associated HTMLCanvasElement. If this event is not cancelled it will attempt to reset the backing storage to the default state (this is equivalent to calling CanvasRenderingContext2D.reset()). On success it will fire the contextrestored event, indicating that the context is ready to reinitialize and redraw.

Syntax Parameters

None.

Return value

true if the rendering context was lost; false otherwise.

Examples
const ctx = canvas.getContext("2d");

if (ctx.isContextLost()) {
  console.log("Context is lost");
}
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