W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2010

Re: [DataCache] Event Handlers on DataCache

From: Nikunj R. Mehta <nikunj.mehta@oracle.com>
Date: Fri, 1 Jan 2010 10:58:08 -0800
Cc: public-webapps@w3.org
Message-Id: <44BB23B2-E9CD-4540-AC64-E4C63C319D05@oracle.com>
To: Joseph Pecoraro <joepeck02@gmail.com>

On Dec 16, 2009, at 11:36 PM, Joseph Pecoraro wrote:

> There are a number of new event handlers on the DataCache interface:
> http://dev.w3.org/2006/webapi/DataCache/#async-datacache-interface

In the revised spec, event handlers are defined on the  
CacheTransactionRequest object only.

>
> Before (and still) tasks are queued at the cache host level (document)
> and can be caught like so:
>
>  // Handle any cache events
>  document.addEventListener('fetching', function(event) {
>    var cache = event.cache;
>    ...
>  }, false);
>
>
> Now there are event handler attributes are on the DataCache itself
> meaning you should also be able to do:
>
>  var cache = window.openDataCache();
>  cache.onOfflineUpdate = function() { ... };
>
> I see a potential problem with the "onFetching" event. When you create
> an online transaction from a data cache, a new data cache is created:
> http://dev.w3.org/2006/webapi/DataCache/#starting-a-transaction
>
> [[
> Create a new data cache, called data cache, in cache group which
> holds all the same resources as the relevant data cache of cache  
> group.
> ]]
>
> In such a case the "onFetching" event seems to have a problem.
>
>  var cache = window.openDataCache();
>  cache.onFetching = function() { ... }
>  cache.onlineTransaction(function(tx) {
>    // NOTE: this created a new cache
>  });
>
> If the onFetching event is intended to fire on the old cache, then
> I suggest a Note of some sort be added to the Specification to
> clarify this.
>
> The problem does not exist for offlineTransactions, which
> reuse the current cache, and never fire "onFetching".

This event is no longer used.

>
> Also, are new APIs switching to camel case for event handler
> attributes? I've always seen them all lowercase.

That was a typo and has been corrected.

Nikunj Mehta
http://blog.o-micron.com
Received on Friday, 1 January 2010 19:00:02 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:36 GMT