| 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 24 matching lines...) Expand all Loading... |
| 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 | 40 could be set to the module's ``Document`` itself, in case the point of |
| 41 the 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 runs the following steps: |
| 46 the imported module's ``exports`` value, and for each property that is | 46 - let export be the imported module's ``exports`` value |
| 47 an element constructor (generated by ``registerElement()``), it adds | 47 - try to import export |
| 48 an element to the importee's element registry. | 48 - if that fails: |
| 49 - try to import each property of export |
| 50 |
| 51 "Try to import" a value means to run the following steps: |
| 52 - if the value is an element constructor (generated by |
| 53 ``registerElement()``), call this importer module's |
| 54 ``registerElement()`` with the value |
| 49 | 55 |
| 50 ### IDL ### | 56 ### IDL ### |
| 51 | 57 |
| 52 ```javascript | 58 ```javascript |
| 53 dictionary InternalElementOptions { | 59 dictionary InternalElementOptions { |
| 54 String tagName; | 60 String tagName; |
| 55 Boolean shadow = false; | 61 Boolean shadow = false; |
| 56 Object prototype = Element; | 62 Object prototype = Element; |
| 57 } | 63 } |
| 58 interface InternalElementConstructorWithoutShadow { | 64 interface InternalElementConstructorWithoutShadow { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 Where ``name_1`` through ``name_n`` are the names bound to the | 156 Where ``name_1`` through ``name_n`` are the names bound to the |
| 151 various named imports in the script element's document, | 157 various named imports in the script element's document, |
| 152 ``source_code`` is the text content of the script element, | 158 ``source_code`` is the text content of the script element, |
| 153 ``source_module`` is the ``Module`` object of the script element's | 159 ``source_module`` is the ``Module`` object of the script element's |
| 154 module, and ``value_1`` through ``value_n`` are the values | 160 module, and ``value_1`` through ``value_n`` are the values |
| 155 exported by the various named imports in the script element's | 161 exported by the various named imports in the script element's |
| 156 document. | 162 document. |
| 157 | 163 |
| 158 When an import fails to load, the ``as`` name for the import gets | 164 When an import fails to load, the ``as`` name for the import gets |
| 159 bound to ``undefined``. | 165 bound to ``undefined``. |
| OLD | NEW |