scala-js / scala-js-dom

Statically typed DOM API for Scala.js
Other
315 stars 160 forks source link

Add support for Web NFC API #806

Closed FabioPinheiro closed 6 months ago

FabioPinheiro commented 11 months ago

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

FabioPinheiro commented 11 months ago

I'm getting an error when running sbt prePR:

Error ```sbt [error] scalafix.internal.v1.FileException: unexpected error processing file /home/fabio/workspace/scala-js-dom/dom/src/main/scala/org/scalajs/dom/NDEFReadingEvent.scala [error] Caused by: java.util.NoSuchElementException: None.get [error] at scala.None$.get(Option.scala:529) [error] at scala.None$.get(Option.scala:527) [error] at org.scalajs.dom.scalafix.GenerateApiReport.org$scalajs$dom$scalafix$GenerateApiReport$$process(GenerateApiReport.scala:37) ... ```

It doesn't happen anymore don't know why

FabioPinheiro commented 11 months ago

Also when generating the docs I get some warnings

I have no idea what is this No DRI found for query I found a ticket about it but I don't understand. https://github.com/lampepfl/dotty/issues/14212

[info] Wrote /home/fabio/workspace/scala-js-dom/dom/target/scala-3.1.3/scalajs-dom_sjs1_3-2.6.0+57-85699865+20230812-1359-SNAPSHOT.pom
[info] Main Scala API documentation to /home/fabio/workspace/scala-js-dom/dom/target/scala-3.1.3/api...
[info] Skipping unused scalacOptions: -Xsemanticdb, -semanticdb-target
[warn] -- Warning: dom/src/main/scala/org/scalajs/dom/NDEFReader.scala:21:6 -----------
[warn] 21 |  def scan(options: NDEFScanOptions = js.native): js.Promise[Any] = js.native
[warn]    |      ^
[warn]    |      No DRI found for query: Promise
[warn] -- Warning: dom/src/main/scala/org/scalajs/dom/NDEFReader.scala:37:6 -----------
[warn] 37 |  def write(message: NDEFRecord.Data, options: NDEFWriteOptions = js.native): js.Promise[String] = js.native
[warn]    |      ^
[warn]    |      No DRI found for query: Promise
[warn] two warnings found
[info] Main Scala API documentation successful.

Fixed

FabioPinheiro commented 9 months ago

@armanbilge Thanks for the review I only saw it today when I was updating the version of the lib. If you could review it again would be much appreciated I have a couple of questions

FabioPinheiro commented 9 months ago

https://w3c.github.io/web-nfc/ format seems more clear to follow. I did another review of all fields to seem if they are optional or not. Hopefully everything is correct now.

FabioPinheiro commented 7 months ago

Would be nice to have this merged before the next release

zetashift commented 6 months ago

@FabioPinheiro sorry for the wait, and thank you so much for this PR!