This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
spec:async-algos [2014/05/27 18:17] – created tabatkins | spec:async-algos [2014/05/28 12:24] – [Making Author-Observable Changes to Page State] tabatkins | ||
---|---|---|---|
Line 38: | Line 38: | ||
Be careful about making any change to the state of the document within the asynchronous portion of the algorithm. | Be careful about making any change to the state of the document within the asynchronous portion of the algorithm. | ||
- | If you do make any changes, {{something about queueing | + | The correct way to make an observable change is in a synchronous block that is explicitly put on a task queue. |
- | Note that fulfilling a promise is not author-observable; they can't tell whether it was fulfilled until the end of their code, when tasks and microtasks run, so it's safe. | + | > When the load() method is called, execute these steps: |
+ | > | ||
+ | > 1. Let font face be the FontFace object on which this method was called. | ||
+ | > | ||
+ | > 2. If font face’s %%[[Urls]] slot is null, or its status attribute is anything other than " | ||
+ | > | ||
+ | > 3. Otherwise, set font face’s status attribute to " | ||
+ | > | ||
+ | > 4. Using the value of font face’s %%[[Urls]] slot, attempt to load a font as defined in [CSS3-FONTS], | ||
+ | > | ||
+ | > 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 " | ||
+ | > b. Otherwise, set font face's status attribute to " | ||
+ | |||
+ | 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' | ||
+ | |||
+ | If there is further asynchronous work to be done, explicitly state " | ||
+ | |||
+ | Note that fulfilling a promise is not author-observable, because |