HTMLCanvasElement.transferControlToOffscreen()
Baseline 2023Newly available
Since March 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
方法 HTMLCanvasElement.transferControlToOffscreen()
将控制转移到一个在主线程或者 web worker 的 OffscreenCanvas
对象上。
语法
js
transferControlToOffscreen()
返回值
一个 OffscreenCanvas
对象。
样例
js
var htmlCanvas = document.createElement("canvas");
var offscreen = htmlCanvas.transferControlToOffscreen();
var gl = offscreen.getContext("webgl");
// ... some drawing using the gl context ...
// Push frames back to the original HTMLCanvasElement
gl.commit();
规范
Specification |
---|
HTML # dom-canvas-transfercontroltooffscreen-dev |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
transferControlToOffscreen |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
参见
- 定义此方法的接口
HTMLCanvasElement
OffscreenCanvas