Re: [web-nfc] NFCReadingEvent has an attribute with a type of dictionary? (#232)

> @reillyeon how would you set the data for each record with this API?

The new interface types would take the renamed `NDEFMessageInit` and `NDEFRecordInit` dictionaries as constructor parameters,

```
dictionary NDEFMessageInit {
  USVString url;
  sequence<NDEFRecordInit> records;
};

dictionary NDEFRecordInit {
  NDEFRecordType recordType;
  USVString mediaType;
  NDEFRecordData data;
};
```

Alternatively we could reuse `NDEFMessageSource` as the constructor parameter type for `NDEFMessage` because it has already been designed to be a little easier to use with the `push()` method. In fact, we could have `push()` optionally take an NDEFMessageInit directly.

All that said it seems like replacing `NFCReadingEvent` with a method like `Promise<NDEFMessage> read()` is a much simpler solution.

-- 
GitHub Notification of comment by reillyeon
Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/232#issuecomment-505558320 using your GitHub account

Received on Tuesday, 25 June 2019 18:07:54 UTC