[w3c/clipboard-apis] Support for delayed clipboard data (#41)

Apple [explains this](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/PasteboardGuide106/Articles/pbConcepts.html#//apple_ref/doc/uid/TP40008101-SW10) well:

>If a pasteboard item supports multiple representations, it is typically impractical or time- and resource-consuming to put the data for each representation onto the pasteboard. For example, say your application places an image on the pasteboard. For maximum compatibility, it might be useful for the image to provide a number of different representations, including PNG, JPEG, TIFF, GIF, and so on. Creating each of these representations, however, would require time and memory.
>
>Rather than requiring an item to provide all of the representations it offers, a pasteboard only asks for the first representation in the list of representations an item offers. If a paste recipient wants a different representation, the item can generate it when it’s requested.

Has something like this been considered? For example, instead of: 

```js
var data = new DataTransfer();
data.items.add("text/plain", "foo");
data.items.add("expensive", generateExpensiveData());
navigator.clipboard.write(data);
```

we could have something like:

```js
var data = new DataTransfer();
data.items.add("text/plain", "foo");
data.items.add("expensive", function () {
  // Called only when something tries to read data for the "expensive" type
  return generateExpensiveData();
});
navigator.clipboard.write(data);
```

-- 
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/issues/41

Received on Sunday, 26 March 2017 16:42:01 UTC