Re: Standby API Specification Proposal

On mer., 2014-02-05 at 15:36 +0000, Kostiainen, Anssi wrote:
> > It felt to me that the use cases were not particularly on the
> > native-side of things: watching a video, navigating (say with Google
> > Maps), or playing an accelerometer-based game seem classical use cases
> > for Web apps.
> 
> Right. I meant, on the native side developers seem to use these
> capabilities, and the users expect this type of behavior. I agree
> most, if not all, of the use cases would work for the Web similarly.
> The permission model will be important to get right to prevent misuse.

We're on the same page then :)

> > That train of thoughts might be worth exploring; could you maybe
> > describe in more details what you have in mind here? i.e. when would a
> > web app give such a hint, and what a UA might do with it?
> 
> Let me try: an imaginary setPriority() delivers a hint to the UA of
> the preferred priority (this can get more granular, but for the sake
> of simplicity let’s call this the priority of the whole app). The
> developer defined noPendingTasks boolean signals whether there are
> pending, time-critical tasks to be performed. Here’s an example which
> hopefully better explains what I had in mind:
> 
> document.addEventListener("visibilitychange", function () {
>   if (document.hidden && noPendingTasks) {
>     // nothing time-sensitive going on, priority can be lowered 
>     setPriority(“low");
>   } else if (document.hidden && !noPendingTasks) {
>     // time-sensitive pending tasks ongoing, prefer normal priority
>     setPriority("default");
>   }
>   // ...
> });
> 
> Currently, some browsers [1,2] automatically throttle things like
> setTimeout/setInterval() in background tabs and/or minimized,
> invisible windows. The imaginary setPriority() would be a mechanism to
> opt-out from those optimizations.

I get the idea now; in some sense, it is close to the other usage of
Mozilla and Chrome APIs that let developers ask for a grab on CPU (to
avoid having it go on power saving). Might be worth asking WebPerf their
thoughts on this.

Dom

Received on Wednesday, 5 February 2014 16:26:16 UTC