W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2018

Re: web Worker API suggestion

From: Andre Venancio <info@andrevenancio.com>
Date: Mon, 21 May 2018 17:17:06 +0100
Message-ID: <CAN6p1-0=fE=YsmSN=WWPnAifK6tD+BMv9jRa2spQco24o4MWZw@mail.gmail.com>
To: Jake Archibald <jakearchibald@google.com>
Cc: reillyg@chromium.org, Patrick.Kettner@microsoft.com, public-webapps <public-webapps@w3.org>
What are the channels normally used to help this proposal move forward?

On Mon, 21 May 2018 at 13:21 Jake Archibald <jakearchibald@google.com>
wrote:

> More info on that proposal: https://github.com/domenic/proposal-blocks/
>
> On Wed, May 16, 2018 at 1:35 PM Andre Venancio <info@andrevenancio.com>
> wrote:
>
>> Hi Reilly.
>>
>> Thanks for sharing. Really useful. I like that Block concept that's
>> mentioned there!
>> Happy I'm not alone :D
>>
>>
>>
>> On Tue, 15 May 2018 at 21:17 Reilly Grant <reillyg@chromium.org> wrote:
>>
>>> At BlinkOn 9 there was discussion of how ergonomics of the Worker API
>>> could be improved in ways similar to what you suggest. Video of that
>>> session is here
>>> <https://drive.google.com/file/d/18V0baK57sAUFtD6uO9neLtZY8pR-Fzvn/view>
>>> .
>>> Reilly Grant | Software Engineer | reillyg@chromium.org | Google Chrome
>>> <https://www.google.com/chrome>
>>>
>>>
>>> On Mon, May 14, 2018 at 10:21 AM Andre Venancio <info@andrevenancio.com>
>>> wrote:
>>>
>>>> Hi Patrick.
>>>> Been having a look at that option too, however a linter wouldnt easily
>>>> parse that in order to validate my javascript.. I do understand your point,
>>>> however makes me feel dirty having to include a task for copying static
>>>> file around from my SRC to my DIST folders. would be easier if there was a
>>>> way of accessing another memory thread without having to handle this
>>>> external file requirement.
>>>>
>>>>
>>>>
>>>> On Sun, 13 May 2018 at 21:07 Patrick Kettner <
>>>> Patrick.Kettner@microsoft.com> wrote:
>>>>
>>>>> Hey Andre!
>>>>> The issue with this is that it would not be obvious that you are
>>>>> unable to pass objects from the current scope into the worker (which would
>>>>> break the entire purpose of having a fast codepath in another thread). You
>>>>> *can* construct one from a string, however. You just need to wrap it
>>>>> up like a file
>>>>> <https://stackoverflow.com/questions/10343913/how-to-create-a-web-worker-from-a-string>
>>>>>
>>>>> cheers
>>>>>
>>>>> patrick
>>>>> ------------------------------
>>>>> *From:* Andre Venancio <info@andrevenancio.com>
>>>>> *Sent:* Friday, May 11, 2018 9:25 AM
>>>>> *To:* public-webapps@w3.org
>>>>> *Subject:* web Worker API suggestion
>>>>>
>>>>> Hi,
>>>>> Not sure this is the best email to contact you guys regarding an API
>>>>> suggestion, but here it goes:
>>>>>
>>>>>
>>>>> I've been thinking about this for a while now, and I think it would be
>>>>> beneficial to update the Worker api to allow you to pass a IIFI function
>>>>> instead of a external file?
>>>>>
>>>>> From: current Worker API:
>>>>>
>>>>> const worker = new Worker('lame.js');
>>>>> worker.onmessage = (e) => {
>>>>> console.log(e);
>>>>> };
>>>>>
>>>>> // lame.js
>>>>> this.addEventListener('message', (e) => {
>>>>> this.postMessage({ message: 'hello back' });
>>>>> });
>>>>>
>>>>>
>>>>> to
>>>>>
>>>>> const worker = new Worker(() => {
>>>>> this.addEventListener('message', (e) => {
>>>>> this.postMessage({ message: 'hello back' });
>>>>> });
>>>>> });
>>>>> worker.onmessage = (e) => {
>>>>> console.log(e);
>>>>> };
>>>>>
>>>>>
>>>>> Wouldn't this be better?
>>>>>
>>>>> Thanks
>>>>> Andre
>>>>>
>>>>
Received on Monday, 21 May 2018 16:18:24 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:15:14 UTC