| 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 11 matching lines...) Expand all Loading... |
| 22 registered, the parser waits until the list of outstanding | 22 registered, the parser waits until the list of outstanding |
| 23 dependencies is empty. After the parser has finished parsing, the | 23 dependencies is empty. After the parser has finished parsing, the |
| 24 document waits until its list of outstanding dependencies is empty | 24 document waits until its list of outstanding dependencies is empty |
| 25 before the module it represents is marked complete. | 25 before the module it represents is marked complete. |
| 26 | 26 |
| 27 | 27 |
| 28 Module API | 28 Module API |
| 29 ---------- | 29 ---------- |
| 30 | 30 |
| 31 Within a script in a module, the ``module`` identifier is bound to | 31 Within a script in a module, the ``module`` identifier is bound to |
| 32 the [``Module`` object](apis.md) that represents the module. | 32 the ``Module`` object that represents the module. |
| 33 | 33 |
| 34 ### Exporting values ### | 34 ### Exporting values ### |
| 35 | 35 |
| 36 A module can export a value by assigning the ``exports`` property of | 36 A module can export a value by assigning the ``exports`` property of |
| 37 its ``Module`` object. By default, the ``exports`` property of a | 37 its ``Module`` object. By default, the ``exports`` property of a |
| 38 ``Module`` is an empty Object. Properties can be added to the object, | 38 ``Module`` is an empty Object. Properties can be added to the object, |
| 39 or, it can be set to an entirely different object; for example, it | 39 or, it can be set to an entirely different object; for example, it |
| 40 could be set to the module's Document itself, in case the point of the | 40 could be set to the module's ``Document`` itself, in case the point of |
| 41 module is to expose some ``template`` elements. | 41 the module is to expose some ``template`` elements. |
| 42 | 42 |
| 43 ### Exporting element definitions ### | 43 ### Exporting element definitions ### |
| 44 | 44 |
| 45 When importing a module into another, Sky looks at the properties on | 45 When importing a module into another, Sky looks at the properties on |
| 46 the imported module's ``exports`` value, and for each property that is | 46 the imported module's ``exports`` value, and for each property that is |
| 47 an element constructor (generated by ``registerElement()``), it adds | 47 an element constructor (generated by ``registerElement()``), it adds |
| 48 an element to the importee's element registry. | 48 an element to the importee's element registry. |
| 49 | 49 |
| 50 ### IDL ### | 50 ### IDL ### |
| 51 | 51 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 Where ``name_1`` through ``name_n`` are the names bound to the | 113 Where ``name_1`` through ``name_n`` are the names bound to the |
| 114 various named imports in the script element's document, | 114 various named imports in the script element's document, |
| 115 ``source_code`` is the text content of the script element, | 115 ``source_code`` is the text content of the script element, |
| 116 ``source_module`` is the ``Module`` object of the script element's | 116 ``source_module`` is the ``Module`` object of the script element's |
| 117 module, and ``value_1`` through ``value_n`` are the values | 117 module, and ``value_1`` through ``value_n`` are the values |
| 118 exported by the various named imports in the script element's | 118 exported by the various named imports in the script element's |
| 119 document. | 119 document. |
| 120 | 120 |
| 121 When an import fails to load, the ``as`` name for the import gets | 121 When an import fails to load, the ``as`` name for the import gets |
| 122 bound to ``undefined``. | 122 bound to ``undefined``. |
| OLD | NEW |