W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2013

[futures] Making ProgressFuture immediate

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 11 Apr 2013 16:05:46 -0700
Message-ID: <CAAWBYDBhVgp9oyg+Hc+-C4-asA_N25k7Onxu0oOjQgNT2zRv2g@mail.gmail.com>
To: www-dom@w3.org
A common use-case for ProgressFuture will be using the progress values
to drive progress UI for the user.  However, the current design is
flawed for this use-case.  Right now, the progress callback is only
called when the future's resolver posts a new progress update.  That
prevents you from initializing the progress UI with the "current"
progress - you have to wait until the next heartbeat occurs, which may
be an arbitrary amount of time in the future.  This is precisely the
sort of "just missed it" race condition that futures were designed to
avoid.

I propose that we change it so that, if at least one progress update
has already been made and the future isn't yet resolved, the progress
callback is immediately (next tick) called with the most recent
progress value.  That way the progress updates also act kinda like
futures in general, which is nice.

~TJ
Received on Thursday, 11 April 2013 23:06:42 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:20 UTC