- From: Reilly Grant via GitHub <sysbot+gh@w3.org>
- Date: Tue, 25 Jun 2019 16:58:06 +0000
- To: public-web-nfc@w3.org
`read()` vs. `onreading` seems like not too big a difference and the ergonomics of one vs. the other seem to hinge on whether a page will typically enable a reader for multiple tag reads or only one.
To compare further to the `Body` object. Could we rewrite the IDL like this?
```
[Constructor(NDEFMessageInit messageInit)]
interface NDEFMessage {
readonly attribute USVString url;
readonly attribute FrozenArray<NDEFRecord> records;
}
[Constructor(NDEFRecordInit recordInit)]
interface NDEFRecord {
readonly attribute NDEFRecordType recordType;
readonly attribute USVString mediaType;
[NewObject] DOMString string();
[NewObject] any json();
[NewObject] ArrayBuffer data();
}
```
The disadvantage of using interfaces rather than dictionaries for these types seems to be that it makes constructing messages more difficult as you have to say `new NDEFMessage({ ... })` rather than passing a dictionary directly. Then again, maybe we could support passing `NDEFMessageInit` (renamed from `NDEFMessage`) directly to methods like `push()`.
--
GitHub Notification of comment by reillyeon
Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/232#issuecomment-505532048 using your GitHub account
Received on Tuesday, 25 June 2019 16:58:08 UTC