scala-js/scala-js-dom

`Clipboard#{read,write}` are wrong

armanbilge opened this issue ยท 4 comments

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

I can pick this up if you like!

@zetashift yes please! ๐Ÿ˜ƒ I have a renewed interest in all these APIs because of my new fs2-dom pet project ๐Ÿ˜‹

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

@zetashift I think it should be this

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

undefined is () aka Unit in Scala.js