OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <title>Service Workers: Client</title> |
| 4 <head> |
| 5 <link rel="help" href="https://w3c.github.io/ServiceWorker/#client"> |
| 6 <script src="/resources/testharness.js"></script> |
| 7 <script src="/resources/testharnessreport.js"></script> |
| 8 |
| 9 <script src=/resources/WebIDLParser.js></script> |
| 10 <script src=/resources/idlharness.js></script> |
| 11 |
| 12 </head> |
| 13 <body> |
| 14 |
| 15 <script type=text/plain id="idl_0"> |
| 16 [Constructor()] // no-op constructor |
| 17 interface Client { |
| 18 readonly attribute unsigned long id; |
| 19 void postMessage(any message, DOMString targetOrigin, |
| 20 optional sequence<Transferable> transfer); |
| 21 }; |
| 22 </pre> |
| 23 |
| 24 <!-- |
| 25 The `Client` interface represents the window or the worker (defined as client) |
| 26 that is [controlled][1] by the Service Worker. This object provides a no-op |
| 27 constructor. Callers should note that only `Client` objects created by the user |
| 28 agent (see [`this.clients.getServiced()`][2]) will provide meaningful |
| 29 functionality. |
| 30 |
| 31 The `id` of a `Client` identifies the specific client object from the list of |
| 32 client objects serviced by the Service Worker. The `postMessage(message, |
| 33 targetOrigin, transfer)` method of a `[Client][3]`, when called, causes a |
| 34 `[MessageEvent][4]` to be dispatched at the client object. |
| 35 |
| 36 |
| 37 |
| 38 [1]: #document-control |
| 39 [2]: #get-serviced-method |
| 40 [3]: #client-interface |
| 41 [4]: http://goo.gl/4SLWiH |
| 42 --> |
| 43 |
| 44 |
| 45 <script type=text/plain id="untested_idls"> |
| 46 interface Transferable {}; |
| 47 </pre> |
| 48 |
| 49 <script> |
| 50 var idl_array = new IdlArray(); |
| 51 idl_array.add_untested_idls(document.getElementById("untested_idls").tex
tContent); |
| 52 idl_array.add_idls(document.getElementById("idl_0").textContent); |
| 53 idl_array.add_objects({ |
| 54 Client: ["throw new Error ('No object defined for the Client interfa
ce')"] |
| 55 }); |
| 56 idl_array.test(); |
| 57 </script> |
| 58 |
| 59 </body> |
| 60 </html> |
| 61 |
OLD | NEW |