W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2014

Re: [whatwg] Notifications and service workers

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 29 Sep 2014 12:18:23 -0700
Message-ID: <CA+c2ei_sOVgG1x-hLTcCLu0Bw41xrxFiW8w2vmdM0T+-jFb=eg@mail.gmail.com>
To: Andrew Wilson <atwilson@google.com>
Cc: WHATWG <whatwg@whatwg.org>, "Tab Atkins Jr." <jackalmage@gmail.com>, Jake Archibald <jaffathecake@gmail.com>, Robert Bīndar <robertbindar@gmail.com>, Peter Beverloo <beverloo@google.com>
On Mon, Sep 29, 2014 at 4:35 AM, Andrew Wilson <atwilson@google.com> wrote:
> I'm sorry, I meant that you can only use the 'data' attribute, if the data
> you want to associate with the notification is structured-cloneable. Which
> precludes lots of interesting stuff, like objects with attached methods,
> memoized functions, etc.
> I'm aware that 'data' is structured-cloneable - I'm saying that's not
> sufficient for many uses.

Based on your emails later in this thread, it sounds like gmail might
not be relying on being able to associate non-structured-clonable data
with non-persistent Notifications.

However I realized this morning that this actually is doable. You can
simply set "expando" properties, or use a WeakMap, to associate
arbitrary data with a Notification object instance.

So in case it's needed, or just beneficial, this is actually doable.

/ Jonas
Received on Monday, 29 September 2014 19:19:18 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:23 UTC