- From: Glenn Maynard <glenn@zewt.org>
- Date: Thu, 2 Jun 2011 16:27:21 -0400
- To: Kenneth Russell <kbr@google.com>
- Cc: David Levin <levin@chromium.org>, Jonas Sicking <jonas@sicking.cc>, ben turner <bent.mozilla@gmail.com>, "public-webapps@w3.org" <public-webapps@w3.org>
On Thu, Jun 2, 2011 at 4:16 PM, Kenneth Russell <kbr@google.com> wrote:
> On Thu, Jun 2, 2011 at 12:53 PM, David Levin <levin@chromium.org> wrote:
> The desire would be for this change to apply not just to the
> postMessage method on MessagePort and Worker but also to that on
> Window.
I agree--the postMessage interfaces shouldn't drift apart more than
necessary. Adding another argument to window.postMessage would be
unfortunate, though: that brings it up to four, which is hitting the
limit of a sane, rememberable API.
Alternatively--and this has come up repeatedly of late--allow the
final argument to be an object. If it's an object, it looks like
this:
port.postMessage({frameBuffer: frame}, {transfer: [frame], ports: [port]});
where "transfer" and "port" are both optional. If it's an array, it
behaves as it does now.
This also allows preserving MessagePort error checking: you can still
throw INVALID_STATE_ERR if something other than a MessagePort is
included in ports.
--
Glenn Maynard
Received on Thursday, 2 June 2011 20:27:49 UTC