getContext method

RenderingContext? getContext(
  1. String contextId, [
  2. JSAny? options
])

The HTMLCanvasElement.getContext() method returns a drawing context on the canvas, or null if the context identifier is not supported, or the canvas has already been set to a different context mode.

Later calls to this method on the same canvas element, with the same contextType argument, will always return the same drawing context instance as was returned the first time the method was invoked. It is not possible to get a different drawing context object on a given canvas element.

Implementation

external RenderingContext? getContext(
  String contextId, [
  JSAny? options,
]);