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

For cloning the json data provided by NDEFRecordInit, I'd have NDEFRecord ctor stringify the json and save the result string, then make json() generate/return a new json object each time by parsing the saved string.

But, the above stringify/parse operation for json data helps me think more about this issue, actually, it can help us still keep the original `readonly attribute DEFRecordData data` for `NDEFRecord` interface, if we want.
By my understanding, `Body` provides `json(), arrayBuffer(), text(), blob()` etc. for getting multiple forms of data from only **one** given data source, all of them could return meaningful things, while our `NDEFRecord` seems a different case that the data type for a given `NDEFRecord` instance is fixed, it can only be one type, either String, or ArrayBuffer, or JSON, i.e. calling `json()` on a record with array buffer data will just get null.
So maybe we'd better still keep `readonly attribute DEFRecordData data`?

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

Received on Monday, 1 July 2019 09:43:30 UTC