We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
write()
Right now, the spec is not clear about how unsupported data types should be handled in write().
I think there are a few reasonable options:
Promise<Array<{[type: string]: boolean}>>
It would also be useful if there was a way to query for supported types (#67), especially in the last case.
Consider the following snippet:
document.body.addEventListener("click", async function() { console.log("copying!"); const item = new ClipboardItem({ "food/falafel": new Blob(["\uD83E\uDDC6"], { type: "food/falafel" }) }); await navigator.clipboard.write([item]); console.log("copied!"); });
Chrome throws an error. It seems to be DOMException for unknown data types and NotAllowedException for known but unsupported data types.
DOMException
NotAllowedException
Safari resolves the Promise without an error.
Note that since the return type is Promise<void>, there is no other way (in general) to check that the copy operation succeeded as expected.
Promise<void>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Right now, the spec is not clear about how unsupported data types should be handled in
write()
.I think there are a few reasonable options:
write()
a return type ofPromise<Array<{[type: string]: boolean}>>
.It would also be useful if there was a way to query for supported types (#67), especially in the last case.
Conflicting browser implementations
Consider the following snippet:
Chrome throws an error. It seems to be
DOMException
for unknown data types andNotAllowedException
for known but unsupported data types.Safari resolves the Promise without an error.
Note that since the return type is
Promise<void>
, there is no other way (in general) to check that the copy operation succeeded as expected.The text was updated successfully, but these errors were encountered: