Open
Description
Problem
- Return type of getContext is not clear
val canvas = document.querySelector("#monadcanvas").asInstanceOf[HTMLCanvasElement]
val ctx = canvas.getContext("2d", js.Dictionary("alpha" -> true))
ctx.beginPath(); // beginPath is not automatically recommended even though it is an internal function of ctx
Current
abstract class HTMLCanvasElement extends HTMLElement {
// When returning to js.Dynamic, the API type required for drawing is not inferred
def getContext(contextId: String, args: js.Any*): js.Dynamic = js.native
}
Suggest is..
[ contextId ] -> [ return type ]
"2d" -> CanvasRenderingContext2D
"webgl" or "experimental-webgl" -> WebGLRenderingContext
"webgl2" -> WebGL2RenderingContext
"webgpu" -> GPUCanvasContext
"bitmaprenderer" -> ImageBitmapRenderingContext
// This is only match when contextType value is "2d" , We need general matching function ...
def getContext(contextType: String,
contextAttributes: js.UndefOr[js.Dictionary[js.Any]] = js.native): CanvasRenderingContext2D = js.native
Metadata
Metadata
Assignees
Labels
No labels