getContext

fun <T : RenderingContext, O : JsAny> getContext(contextId: RenderingContextId<T, O>, options: O? = definedExternally): T?(source)

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.

MDN Reference