Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
spec:async-algos [2014/05/28 12:24] – [Making Author-Observable Changes to Page State] tabatkinsspec:async-algos [2014/05/28 12:26] – [Making Author-Observable Changes to Page State] tabatkins
Line 25: Line 25:
  
 > 6. Otherwise, font face now represents the loaded font; fulfill font face’s %%[[FontStatusPromise]] with font face and set font face’s status attribute to "loaded".%% > 6. Otherwise, font face now represents the loaded font; fulfill font face’s %%[[FontStatusPromise]] with font face and set font face’s status attribute to "loaded".%%
 +
 +**Important Note: The above code is slightly broken for simplicity.  See the "Making Author-Observable Changes to Page State" for a fully correct version of this algorithm.**
  
 Note how Step 3 is clearly the last synchronous step.  If possible, use that exact wording: "return XXX, and continue executing the rest of this algorithm asynchronously". Note how Step 3 is clearly the last synchronous step.  If possible, use that exact wording: "return XXX, and continue executing the rest of this algorithm asynchronously".
Line 52: Line 54:
 > 5. Once the attempt to load either completes with either success or failure, await a stable state, then synchronously execute the following steps: > 5. Once the attempt to load either completes with either success or failure, await a stable state, then synchronously execute the following steps:
 > >
->   a. If the attempt to load failed, set font face's status attribute to "error", then reject font face's %%[[FontStatusPromise]]%% with a NetworkError. +>   5a. If the attempt to load failed, set font face's status attribute to "error", then reject font face's %%[[FontStatusPromise]]%% with a NetworkError. 
->   b. Otherwise, set font face's status attribute to "loaded", then fulfill font face's %%[[FontStatusPromise]]%% with font face.+> 
 +>   5b. Otherwise, set font face's status attribute to "loaded", then fulfill font face's %%[[FontStatusPromise]]%% with font face.
  
 The "await a stable state" language ensures that author code has reached a point where other code can run, and that nothing else is in the queue to be run.  This ensures that, for example, the promise's callbacks will be called immediately after the status attribute is changed. The "await a stable state" language ensures that author code has reached a point where other code can run, and that nothing else is in the queue to be run.  This ensures that, for example, the promise's callbacks will be called immediately after the status attribute is changed.
 
spec/async-algos.txt · Last modified: 2014/12/09 15:48 by 127.0.0.1
Recent changes RSS feed Valid XHTML 1.0 Valid CSS Driven by DokuWiki