Copies an image to the clipboard. The image is re-encoded before it is written to the clipboard. If the image is invalid, the clipboard is not modified.
The image is provided as an ArrayBuffer
containing the encoded image. JPEG and PNG formats are supported.
Although this API is based on Chrome's clipboard.setImageData()
API, there are some differences:
- The Chrome API is only for apps, not extensions.
- This API requires only the
"clipboardWrite"
permission, while the Chrome version also requires the"clipboard"
permission. - Chrome's API uses callbacks, and this API only supports promises.
- This API does not support the
additionalItems
parameter.
This is an asynchronous function that returns a Promise
.