- From: Zoltan Kis via GitHub <sysbot+gh@w3.org>
- Date: Wed, 12 Aug 2015 12:55:14 +0000
- To: public-web-nfc@w3.org
If we want to proceed with including simplified helper types, and don't want to lose type information, we need to use a variant of Anne's earlier proposal, something like this: ```webidl enum NFCDataType { "url", "string", "json", "opaque" }; dictionary NFCRecord { NFCDataType type; USVString mime; // the more exact MIME type, with defaults for each type above any data; }; dictionary NFCMessage { USVString scope; sequence<NFCRecord> data; }; ``` Unfortunately I don't see how we could merge ```type``` with ```mime``` like [here](https://github.com/w3c/web-nfc/issues/26#issuecomment-129872882) without losing information. If ```type == 'text````, or ```type == 'url'```, then ```data``` will contain a string (implementation takes care of the MIME type/encoding), plus ```mime``` MAY contain additional information or MAY be empty. Then, if ```type == 'json'```, then ```data``` may be ```null```, ```Number```, string, or ```Object```, and ```mime``` contains the originating MIME type (e.e. application/json). Then, if ```type == 'opaque'````, then ```data``` is an ArrayBuffer, and in addition ```mime``` tells clients how exactly to use it. We convey type information end to end, mapping to and from appropriate NDEF record types. Does this sound ok? Name change suggestions? Corrections? -- GitHub Notif of comment by zolkis See https://github.com/w3c/web-nfc/issues/26#issuecomment-130291554
Received on Wednesday, 12 August 2015 12:55:23 UTC