Re: [w3c/clipboard-apis] Add clipboard IDL description. (#158)

@snianu commented on this pull request.



> +  <dl class=note>
+   <dt><code><var>clipboardItem</var> = new ClipboardItem([<var>items</var>, <var>options</var>])</code>
+   <dd>
+   Creates a new [=ClipboardItem=] object. <var>items</var> are used to fill its MIME types and [=Promise=]s to [=Blob=]s corresponding to the MIME types, <var>options</var> can be used to fill its {{ClipboardItemOptions}},
+   as per the example below.
+
+   <pre class="example javascript">
+   const format1 = 'text/plain';
+   const promise_text_blob = Promise.resolve(new Blob(['hello'], {type: format1}));
+   const clipboardItemInput = new ClipboardItem(
+    {[format1]: promise_text_blob},
+    {options: "unspecified"});
+   </pre>
+
+   <dt><code><var>clipboardItem</var>.getType(<var>type</var>)</code>
+   <dd><p>Returns a  [=Promise=] to the [=Blob=] corresponding to the <var>type</var>.</p>

Done.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/pull/158#discussion_r730074180

Received on Friday, 15 October 2021 19:40:32 UTC