Re: [web-nfc] NDEFRecord mediaType should be non null for media records (#387)

I thought about this too.

Media types are allowed to be empty (should not be null). You can actually associated a mime type (you cannot change it) with a lot of records, like text is text/plain

So the question also becomes, are we setting default media types when not explicitly stated? You can say that we do whether it is explicitly saved or not (it is saved implicitly as here we are using the T record). For that to make sense we could throw when someone adds a media type different from text/plain when storing "text".

The other option we have it to simply ignore media type for anything but "media" thus make it nullable amd throw if people try setting it. throw TypeError('mediaType doesn't apply for records of type "text"') 

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

Received on Friday, 18 October 2019 09:19:57 UTC