GPUCanvasContext: canvas property

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{APIRef("WebGPU API")}}{{SecureContext_Header}}{{AvailableInWorkers}}

The **canvas** read-only property of the {{domxref("GPUCanvasContext")}} interface returns a reference to the canvas that the context was created from.

Value

An {{domxref("HTMLCanvasElement")}} or {{domxref("OffscreenCanvas")}} object instance.

Examples

js
const canvas = document.querySelector("#gpuCanvas");
const context = canvas.getContext("webgpu");

// returns an HTMLCanvasElement reference
context.canvas;

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • The WebGPU API