OLD | NEW |
1 Sky module system | 1 Sky module system |
2 ================= | 2 ================= |
3 | 3 |
4 This document describes the Sky module system. | 4 This document describes the Sky module system. |
5 | 5 |
6 Overview | 6 Overview |
7 -------- | 7 -------- |
8 | 8 |
9 The Sky module system is based on the ```import``` element. In its | 9 The Sky module system is based on the ```import``` element. In its |
10 most basic form, you import a module as follows: | 10 most basic form, you import a module as follows: |
(...skipping 12 matching lines...) Expand all Loading... |
23 finished parsing, the document waits until its list of outstanding | 23 finished parsing, the document waits until its list of outstanding |
24 dependencies is empty before the module it represents is marked | 24 dependencies is empty before the module it represents is marked |
25 complete. | 25 complete. |
26 | 26 |
27 Module API | 27 Module API |
28 ---------- | 28 ---------- |
29 | 29 |
30 Within a script in a module, the ```module``` identifier is bound to | 30 Within a script in a module, the ```module``` identifier is bound to |
31 the ```Module``` object that represents the module: | 31 the ```Module``` object that represents the module: |
32 | 32 |
33 ``` | 33 ```javascript |
34 interface Module : EventTarget { | 34 interface Module : EventTarget { |
35 constructor (Application application, Document document); // O(1) | 35 constructor (Application application, Document document); // O(1) |
36 attribute any exports; // O(1) // defaults to the module's document | 36 attribute any exports; // O(1) // defaults to the module's document |
37 readonly attribute Document document; // O(1) // the module's document | 37 readonly attribute Document document; // O(1) // the module's document |
38 readonly attribute Application application; // O(1) | 38 readonly attribute Application application; // O(1) |
39 } | 39 } |
40 ``` | 40 ``` |
41 | 41 |
42 ### Exporting values ### | 42 ### Exporting values ### |
43 | 43 |
(...skipping 24 matching lines...) Expand all Loading... |
68 Where ```name_1``` through ```name_n``` are the names bound to the | 68 Where ```name_1``` through ```name_n``` are the names bound to the |
69 various named imports in the script element's document, | 69 various named imports in the script element's document, |
70 ```source_code``` is the text content of the script element, | 70 ```source_code``` is the text content of the script element, |
71 ```source_module`` is the ```Module``` object of the script element's | 71 ```source_module`` is the ```Module``` object of the script element's |
72 module, and ```value_1``` through ```value_n``` are the values | 72 module, and ```value_1``` through ```value_n``` are the values |
73 exported by the various named imports in the script element's | 73 exported by the various named imports in the script element's |
74 document. | 74 document. |
75 | 75 |
76 When an import fails to load, the ```as``` name for the import gets | 76 When an import fails to load, the ```as``` name for the import gets |
77 bound to ```undefined```. | 77 bound to ```undefined```. |
OLD | NEW |