You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this got lost under the outdated diff, so reposting here just to be sure:
I was matching the browser API. Even if I reject with an error here, the user can't rely on that, since if the Async Clipboard API is used then it may reject without an error. I thought it was better to be consistent. Will add a comment.
Aha, interesting... I wonder why they would standardize around that 🤔
Do you have a link where I can read about this? I tried searching but to me, it didn't seem like the spec mentioned what the Promise should be rejected with.
In the chrome examples it seems like they reject with a proper error:
navigator.clipboard.writeText('Text to be copied').then(()=>{console.log('Text copied to clipboard');}).catch(err=>{// This can happen if the user denies clipboard permissions:console.error('Could not copy text: ',err);});
navigator.clipboard.writeText("some text").then(function(){// Promise resolved successfully.console.log("Copied to clipboard successfully!");},function(){// Promise rejected.console.error("Unable to write to clipboard. :-(");});
And the spec itself doesn't say "reject promise P with error", but simply "reject promise P". So I'm led to believe there's no error argument.
I think this got lost under the outdated diff, so reposting here just to be sure:
Aha, interesting... I wonder why they would standardize around that 🤔
Do you have a link where I can read about this? I tried searching but to me, it didn't seem like the spec mentioned what the
Promise
should be rejected with.In the chrome examples it seems like they reject with a proper error:
ref: https://developers.google.com/web/updates/2018/03/clipboardapi#copy_writing_text_to_the_clipboard
ping @feross
The text was updated successfully, but these errors were encountered: