Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exception info for HTMLCanvasElement.transferControlToOffscreen() and OffscreenCanvas.transferToImageBitmap() #36631

Merged
merged 7 commits into from
Nov 22, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ If the context identifier is not supported, or the canvas has already been set t
### Exceptions

- `InvalidStateError` {{domxref("DOMException")}}
- : Throws if the canvas has transferred its control to offscreen via calling `HTMLCanvasElement.transferControlToOffscreen()`.
- : Throws if the canvas has transferred its control to offscreen by calling {{domxref("HTMLCanvasElement.transferControlToOffscreen()")}}.

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ None.

An {{domxref("OffscreenCanvas")}} object.

### Exceptions

- `InvalidStateError` {{domxref("DOMException")}}
- : Throws if the canvas has been set to a context mode by calling {{domxref("HTMLCanvasElement.getContext()")}} or has transferred its control to offscreen by calling {{domxref("HTMLCanvasElement.transferControlToOffscreen()")}}.
skyclouds2001 marked this conversation as resolved.
Show resolved Hide resolved

## Examples

The following example shows how to transfer control to an {{domxref("OffscreenCanvas")}} object on the main thread.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ If your goal is to pass the `ImageBitmap` to other web APIs which do not consume

If you call `transferToImageBitmap()` and don't intend to pass it to {{domxref("ImageBitmapRenderingContext.transferFromImageBitmap()")}}, consider whether you need to call `transferToImageBitmap()` at all. Many web APIs which accept `ImageBitmap` also accept `OffscreenCanvas` as an argument.

### Exceptions

- `InvalidStateError` {{domxref("DOMException")}}
- : Throws if the canvas has transferred to another context scope, for example, to worker; or hasn't set to a context mode via calling {{domxref("OffscreenCanvas.getContext()")}}.
skyclouds2001 marked this conversation as resolved.
Show resolved Hide resolved

## Examples

```js
Expand Down