-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More flexible parameter to push() #84
Comments
+1 for simplification. typedef (NFCMessage or DOMString or ArrayBuffer) NFCPushMessage;
Promise<void> push (NFCPushMessage message, optional NFCPushOptions options); |
Could you add some examples on how to write text, json, binary etc... then we should add such ones to the spec |
zolkis
added a commit
to zolkis/web-nfc
that referenced
this issue
Nov 4, 2015
…3c#84. Handle push related TAG review comments: simplified and aligned push message, optional push options with sensible defaults, improved push and cancelPush steps, option for suspending watches during push(), editorials.
Merged
Fixed by #88. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Following up on a comment in the F2F review of Web NFC API, the
push()
method could use a simpler way to pass NFC content as argument.The current way is to provide a sequence of NFCRecord objects.
We do need to keep the sequence, and the NFCRecords, for controlling the mapping to NDEF.
To make the spec more coherent with the reads, we could modify it to provide an NFCMessage object, i.e. the sequence above + a URL path, and then deal with the same NFCMessage definition for push and reads.
But now this looks ugly. Still, some may say why to specify a dictionary with
kind
,type
anddata
properties. Even though whenkind
andtype
are not specified, the content is deduced fromdata
type, if possible, and if not, it is treated as "application/octet-stream".We could use defaults, and it would be fine to say:
But isn't that unintuitive, and still ugly?
So another possibility would be to define a union for
push()
parameter, which would simplify the most usual writes. Also, make sensible defaults tooptions
so that it is possible to write:or
The question is, what should be the sensible defaults.
IMO, we could say
Then we will have means to pass a simple data (e.g. serialized JSON as DOMString), and when needed, still have greater control on how the NDEF should look like. When DOMString or ArrayBuffer are passed, the resulting NDEF message will have 2 records (one for payload and one special record). If you need to pass more records, or specify more exact format, then use NFCMessage.
Thoughts?
The text was updated successfully, but these errors were encountered: