Skip to content

Commit

Permalink
Add exception info for `HTMLCanvasElement.transferControlToOffscreen(…
Browse files Browse the repository at this point in the history
…)` and `OffscreenCanvas.transferToImageBitmap()` (mdn#36631)

* Add exception info for `HTMLCanvasElement.transferControlToOffscreen()` and `OffscreenCanvas.transferToImageBitmap()`

* Update files/en-us/web/api/htmlcanvaselement/getcontext/index.md

* Update files/en-us/web/api/htmlcanvaselement/transfercontroltooffscreen/index.md

* Update files/en-us/web/api/offscreencanvas/transfertoimagebitmap/index.md

Co-authored-by: wbamberg <[email protected]>

* Update files/en-us/web/api/htmlcanvaselement/transfercontroltooffscreen/index.md

* Update files/en-us/web/api/offscreencanvas/transfertoimagebitmap/index.md

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update files/en-us/web/api/htmlcanvaselement/transfercontroltooffscreen/index.md

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: wbamberg <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 22, 2024
1 parent f7ddd45 commit 46dd9c0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion files/en-us/web/api/htmlcanvaselement/getcontext/index.md
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,13 @@ None.

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

### Exceptions

- `InvalidStateError` {{domxref("DOMException")}}
- : Throws if:
- the canvas has been set a context mode by calling {{domxref("HTMLCanvasElement.getContext()")}}
- the canvas has transferred its control to offscreen by calling {{domxref("HTMLCanvasElement.transferControlToOffscreen()")}}.

## 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,13 @@ 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, such as a worker
- the canvas context mode has not been set by calling {{domxref("OffscreenCanvas.getContext()")}}.

## Examples

```js
Expand Down

0 comments on commit 46dd9c0

Please sign in to comment.