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