- From: François Beaufort via GitHub <sysbot+gh@w3.org>
- Date: Thu, 03 Oct 2019 13:36:37 +0000
- To: public-web-nfc@w3.org
beaufortfrancois has just created a new issue for https://github.com/w3c/web-nfc:
== Change `toRecords()` to `records` ==
From a web developer perspective the `toText()`, `toArrayBuffer()` and `toJSON()` NDEFRecord methods seem to convert the record to a specified type while the recently added `toRecords()` method seems to be simple getter for a finite and non changing list of records. I understand it is technically not correct, this seems wrong to think that the NDEF Record is converted to a sequence of records.
For this reason, I think we should make it a readonly attribute and simply rename it to `records`. We could also use `children` but it's not my preferred choice.
I'm happy to send a PR if you agree.
```diff
[Exposed=(Window)]
interface NDEFRecord {
constructor(NDEFRecordInit recordInit);
readonly attribute NDEFRecordType recordType;
readonly attribute USVString mediaType;
readonly attribute USVString id;
+ readonly attribute NDEFRecords records;
USVString? toText();
[NewObject] ArrayBuffer? toArrayBuffer();
[NewObject] any toJSON();
- sequence<NDEFRecord> toRecords();
};
+ [Exposed=(Window)]
+ interface NDEFRecords {
+ iterable<NDEFRecord>;
+ readonly attribute unsigned long length;
+ getter NDEFRecord (unsigned long index);
+ };
```
Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/362 using your GitHub account
Received on Thursday, 3 October 2019 13:36:39 UTC