OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <title>Service Workers: state</title> |
| 4 <head> |
| 5 <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-work
er-state"> |
| 6 <script src="/resources/testharness.js"></script> |
| 7 <script src="/resources/testharnessreport.js"></script> |
| 8 |
| 9 </head> |
| 10 <body> |
| 11 |
| 12 <!-- |
| 13 |
| 14 The [ServiceWorker][1] object can be in several states. The `state` attribute |
| 15 must return the current state, which must be one of the following values |
| 16 defined in the [ServiceWorkerState][2] enumeration: |
| 17 |
| 18 `"installing"`: |
| 19 The Service Worker represented by the [ServiceWorker][1] object has entered |
| 20 and is running the steps in the [installation process][3]. During this |
| 21 state, `e.waitUntil(p)` can be called inside the `oninstall` event handler |
| 22 of the associcated [ServiceWorkerGloberScope][4] object to extend the life |
| 23 of the [installing worker][5] until the passed [Promise][6] resolves |
| 24 successfully. This is primarily used to ensure that the Service Worker is |
| 25 not active until all of the core caches are populated. |
| 26 `"installed"`: |
| 27 The Service Worker represented by the [ServiceWorker][1] object has |
| 28 completed the steps in the [installation process][3]. The Service Worker in |
| 29 this state is considered the [worker in waiting][7]. |
| 30 `"activating"`: |
| 31 The Service Worker represented by the [ServiceWorker][1] object has entered |
| 32 and is running the steps in the [activation process][8]. During this state, |
| 33 `e.waitUntil(p)` can be called inside the `onactivate` event handler of the |
| 34 associated [ServiceWorkerGloberScope][9] object to extend the life of the |
| 35 activating [active worker][10] until the passed [Promise][6] resolves |
| 36 successfully. Note that no [functional events][11] are dispatched until the |
| 37 state becomes `"activated"`. |
| 38 `"activated"`: |
| 39 The Service Worker represented by the [ServiceWorker][1] object has |
| 40 completed the steps in the [activation process][8]. The Service Worker in |
| 41 this state is considered the [active worker][10] ready to [control][12] the |
| 42 documents in matching scope upon subsequence [navigation][13]. |
| 43 `"redundant"`: |
| 44 A newly created Service Worker [registration][14] is replacing the current |
| 45 [registration][14] of the Service Worker. |
| 46 |
| 47 |
| 48 |
| 49 [1]: #service-worker-interface |
| 50 [2]: #service-worker-state-enum |
| 51 [3]: #installation-process |
| 52 [4]: #service-worker-glober-scope-interface |
| 53 [5]: #installing-worker |
| 54 [6]: http://goo.gl/3TobQS |
| 55 [7]: #worker-in-waiting |
| 56 [8]: #activation-process |
| 57 [9]: #service-worker-global-scope-interface |
| 58 [10]: #active-worker |
| 59 [11]: #functional-events |
| 60 [12]: #document-control |
| 61 [13]: http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#n
avigate |
| 62 [14]: #registration |
| 63 |
| 64 --> |
| 65 |
| 66 |
| 67 |
| 68 <script> |
| 69 test(function() { |
| 70 // not_implemented(); |
| 71 }, "There are no tests for section state so far."); |
| 72 </script> |
| 73 |
| 74 </body> |
| 75 </html> |
| 76 |
OLD | NEW |