W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2010

[whatwg] Web Workers API

From: Evan Ireland <eireland@sybase.com>
Date: Fri, 2 Jul 2010 16:06:28 +1200
Message-ID: <000b01cb199b$f29271a0$d7b754e0$@com>
Hi,

The IDL for Worker in the Web Workers API specification shows:

    void postMessage(in any message, in optional MessagePortArray ports);

I have a question regarding the 'any' type for message.

If a caller of postMessage passes an object to a worker that is not a
string, is it converted to a string or can non-string objects be propagated
through to the onmessage(event) in the worker.

So if I write:

var w = new MyWorker('MyWorker.js');
w.postMessage(new MyObject());

--------------
// MyWorker.js

onmessage = function(event)
{
    var d = event.data;
    // what type is 'd'?
}

If 'd' is not a string, then is it a MyObject, and if so, how is it supposed
to be marshalled by the inter-worker(thread) communication?

I suggest that whatever the answer, that this be covered when the spec
document is next updated.

Thanks.
Received on Thursday, 1 July 2010 21:06:28 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:24 UTC