WebGPU API
The canvas read-only property of the
GPUCanvasContext interface returns a reference to the canvas that the context was created from.
Value
An HTMLCanvasElement or OffscreenCanvas object instance.
Examples
const canvas = document.querySelector("#gpuCanvas");
const context = canvas.getContext("webgpu");
// returns an HTMLCanvasElement reference
context.canvas;
Specifications
Browser compatibility
See also
- The WebGPU API
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
