[whatwg] Storage Events for a Specific Storage Area

On Tue, 23 Jun 2009 19:51:18 +0200, Joseph Pecoraro <joepeck02 at gmail.com> wrote:
>> Jeremy Orlow: Is it too late?  It seems as though Joseph's
>> suggestion could be in addition to what's already in the spec.
>
> This doesn't break anything in the current spec.  So it wouldn't break
> any existing implementations.  I'm also guessing that the groundwork
> for implementing a feature like this is already in place due to the
> ubiquity of addEventListener.

To be frank, it seems like a lot of bloat though to avoid a simple comparison.


> - Less Listener Functions Fired - Instead of every registered listener
> getting fired on every "storage" event, only those applicable will be
> fired.  This may mean overall less listeners getting fired, and code
> that doesn't have to continually check the affected storageArea,
> leading to potential performance improvements.

Actually, assuming only one of the two solutions would exist the same amount of events would fire. A change to localStorage causes an event to be dispatched and likewise a change to sessionStorage causes an event to be dispatched. Having said that, with your solutions more events will fire since the legacy event will have to be dispatched too.


> Cons:
>
> - This is similar to implementing the full EventTarget Interface on
> Storage areas.  However, the only event of importance on a Storage
> area is "storage" not "click" or "hover" etc.  Invalid event types
> should probably throw an error or something... or maybe this is more
> in the scope of DOM Events.

That is still quite a bit of complexity for little benefit.


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Tuesday, 23 June 2009 11:06:57 UTC