diff --git a/ClipboardAPI/clipboarditem-with-string-data.md b/ClipboardAPI/clipboarditem-with-string-data.md index a612167a..57ec9365 100644 --- a/ClipboardAPI/clipboarditem-with-string-data.md +++ b/ClipboardAPI/clipboarditem-with-string-data.md @@ -10,7 +10,7 @@ The feature is available in Chromium-based browsers in M132 or later behind the Here is an example of writing a ClipboardItem where text data is passed directly as string. -## Example +## Example 1 ```javascript async function writeToClipboard() { @@ -31,4 +31,27 @@ async function writeToClipboard() { console.error(e.message); } } +``` + +Similarly, ClipboardItem data supports promise that resolves to string + +## Example 2 + +```javascript +async function writePromiseToClipboard() { + try { + const promise_text_string = Promise.resolve("Hello World"); + const promise_html_string = Promise.resolve("