Skip to content

Clipboard#{read,write} are wrong #730

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

Closed
armanbilge opened this issue Oct 21, 2022 · 4 comments · Fixed by #736
Closed

Clipboard#{read,write} are wrong #730

armanbilge opened this issue Oct 21, 2022 · 4 comments · Fixed by #736
Assignees

Comments

@armanbilge
Copy link
Member

According to the MDN docs, read and write should be in terms of a js.Array[ClipboardItem]. But that's not what a DataTransfer is ...

https://developer.mozilla.org/en-US/docs/Web/API/Clipboard

def read(): js.Promise[DataTransfer] = js.native

def write(data: DataTransfer): js.Promise[Unit] = js.native

@zetashift
Copy link
Contributor

I can pick this up if you like!

@armanbilge
Copy link
Member Author

@zetashift yes please! 😃 I have a renewed interest in all these APIs because of my new fs2-dom pet project 😋

@zetashift
Copy link
Contributor

zetashift commented Nov 1, 2022

From https://w3c.github.io/clipboard-apis/#dom-clipboard-write

I can't exactly figure out what kind of promise it should return?

Currently have this:

  def write(data: DataTransfer): js.Promise[ClipboardItem] = js.native

@armanbilge
Copy link
Member Author

@zetashift I think it should be this

  def write(data: ClipboardItems): js.Promise[Unit] = js.native

undefined is () aka Unit in Scala.js

@armanbilge armanbilge linked a pull request Nov 2, 2022 that will close this issue
armanbilge added a commit that referenced this issue Nov 5, 2022
Fixup `Clipboard` to use added `ClipboardItem`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants