- From: Peter Beverloo <notifications@github.com>
- Date: Mon, 24 Nov 2014 10:25:41 -0800
- To: w3c/push-api <push-api@noreply.github.com>
- Message-ID: <w3c/push-api/pull/88/r20810493@github.com>
> + <p>
> + The <code><dfn id="widl-PushMessageData-blob-Blob">blob()</dfn></code> method, when
> + invoked, MUST return a <a><code>Blob</code></a> whose contents are <var>bytes</var> and
> + <var>type</var> is not provided.
> + </p>
> + <p>
> + The <code><dfn id="widl-PushMessageData-json-Any">json()</dfn></code> method, when invoked,
> + MUST return the result of invoking the initial value of <a><code>JSON.parse</code></a> with
> + the result of running <a>utf-8 decode</a> on <var>bytes</var> as argument. This may throw
> + an exception.
> + </p>
> + <p>
> + The <code><dfn id="widl-PushMessageData-text-USVString">text()</dfn></code> method, when
> + invoked, MUST return the result of running <a>utf-8 decode</a> on <var>bytes</var>.
> + </p>
> + <div class="idl" title="typedef (Blob or BufferSource or USVString) PushMessageDataInit">
This is really complicated, and would still allow people to use this as a generic converter, just a little bit less obvious.
var event = new PushEvent('PushEvent', 'foobarbaz');
event.data.blob(); // ...
Given that this is a very minor detail, and with very(!) low expected usage, can we simplify this take a string, adding other types if there's a demonstrable need? For now, I'd be concerned about the added complexity.
---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/push-api/pull/88/files#r20810493
Received on Monday, 24 November 2014 18:26:16 UTC