Re: [DataCache] Remove or Replace a Local Server Handler?

> There is no way to remove a handler, or all handlers for a particular
> namespace, after some have been registered. However, this may be a
> valid design decision, because there probably aren't compelling use
> cases for removing or replacing handlers. The only time I ran into
> this need was running multiple tests in a single html file reusing
> the same namespace (uri).
>
> How about an application that wants to seamlessly update its offline
> handlers without reloading the page? It would need to download a
> script that removes the old handlers, and installs the new handlers.
I have added a method to window.navigator to remove any registered  
offline handlers for a given namespace.

>
> Does this sound useful and practical?
>
>
>
> As it stands right now, the Spec should be more specific about how
> registerOfflineHandler handles multiple handlers registered on the
> same namespace.
>
>   var namespace = ...
>   navigator.registerOfflineHandler(namespace, ..., ...); // 1st
>   navigator.registerOfflineHandler(namespace, ..., ...); // 2nd
>
> Possible scenarios:
>
>   1. The 2nd replaces (and removes) the 1st.
>   2. Both remain, the earliest registered handler is the final  
> candidate
>   3. Both remain, the latest registered handler is the final candidate
>   4. A different heuristic.
>
> I would prefer scenario #1. It doesn't make sense to have two  
> different
> handlers for the exact same namespace.  This also cuts down on  
> potential
> memory leaks, references to dead/unreachable code.
>
I have made this change.
Nikunj Mehta
http://blog.o-micron.com

Received on Monday, 4 January 2010 22:42:00 UTC