W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2009

[whatwg] Storage Events for a Specific Storage Area

From: Joseph Pecoraro <joepeck02@gmail.com>
Date: Wed, 17 Jun 2009 13:44:40 -0400
Message-ID: <C5AF1510-43C4-48C2-A837-EF6333B47349@gmail.com>
The "storage" event [1] fires for both sessionStorage and  
localStorage.  To me, this means if you only want to interact with  
localStorage you will have to manually ensure that it is the storage  
area being modified:

   window.addEventListener('storage', function(e) {
     if ( e.storageArea === localStorage ) {
       // ...
     }
   }

Was there any discussion about creating events specific to the storage  
object, or should that already be possible?  I've been playing around  
with WebKit's Storage implementation, and the following  
(understandably) is not possible:

   > localStorage.addEventListener
   undefined

Is there any way to listen to events for a single specific storage  
area or is the previously mentioned approach preferred?

Cheers,
Joe

[1]: http://dev.w3.org/html5/webstorage/#the-storage-event
Received on Wednesday, 17 June 2009 10:44:40 UTC

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