Skip to content
New issue

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

[Delayed Clipboard Rendering] Optional argument for callbacks record in ClipboardItem constructor #611

Closed
sanketj opened this issue Nov 21, 2022 · 2 comments
Assignees
Labels
Delayed Clipboard Rendering Issues related to delayed clipboard rendering

Comments

@sanketj
Copy link
Member

sanketj commented Nov 21, 2022

Instead of adding a new constructor to ClipboardItem for the delayed callback records, can we expand the existing constructor to include an optional argument?

Before:
[RaisesException] constructor(record<DOMString, Promise> items);
[RaisesException] constructor(record<DOMString, Promise> items, record<DOMString, ClipboardDelayedCallback> callbacks);

After:
[RaisesException] constructor(record<DOMString, Promise> items, optional record<DOMString, ClipboardDelayedCallback> callbacks);

@sanketj sanketj added the Delayed Clipboard Rendering Issues related to delayed clipboard rendering label Nov 21, 2022
@snianu
Copy link
Member

snianu commented Nov 21, 2022

can we expand the existing constructor to include an optional argument

I think we had tried that before and IIRC we ran into some compiler issues. Basically, the compiler was refusing to accept an optional record of callbacks. Perhaps we should figure that out first before we publish this explainer to public?

@anaskim
Copy link
Contributor

anaskim commented Mar 10, 2023

We have explored some options to update the IDL. Our current preferred solution is:

typedef (Blob or DOMString) ClipboardItemValue;
callback ClipboardItemValueCallback = ClipboardItemValue ();
typedef Promise<(ClipboardItemValue or ClipboardItemValueCallback)> ClipboardItemInit;

// ...
constructor(record<DOMString, ClipboardItemInit> items);

@anaskim anaskim closed this as completed Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Delayed Clipboard Rendering Issues related to delayed clipboard rendering
Projects
None yet
Development

No branches or pull requests

3 participants