| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 external registerElement(@nonnull String tagname, @nonnull Type elementClass);
// O(1) | 98 external registerElement(@nonnull String tagname, @nonnull Type elementClass);
// O(1) |
| 99 // registers a tag name with the parser | 99 // registers a tag name with the parser |
| 100 // only useful during parse time | 100 // only useful during parse time |
| 101 // verify that tagname isn't null or empty | 101 // verify that tagname isn't null or empty |
| 102 // verify that elementClass is the Type of a class that extends Element (direc
tly or indirectly, but not via "implements" or "with") | 102 // verify that elementClass is the Type of a class that extends Element (direc
tly or indirectly, but not via "implements" or "with") |
| 103 // (see the @tagname code for an example of how to verify that from dart) | 103 // (see the @tagname code for an example of how to verify that from dart) |
| 104 // verify that there's not already a class registered for this tag name | 104 // verify that there's not already a class registered for this tag name |
| 105 // if there is, then mark this tagname is broken, so that it acts as if it's n
ot registered in the parser, | 105 // if there is, then mark this tagname is broken, so that it acts as if it's n
ot registered in the parser, |
| 106 // and, if this is the first time it was marked broken, log a console message
regarding the issue | 106 // and, if this is the first time it was marked broken, log a console message
regarding the issue |
| 107 // (mention the tag name but not the classes, so that it's not observable that
this currently happens out of order) | 107 // (mention the tag name but not the classes, so that it's not observable that
this currently happens out of order) |
| 108 | |
| 109 void init(LibraryMirror library) { | |
| 110 library.declarations.forEach((Symbol s, DeclarationMirror d) { | |
| 111 d.metadata.forEach((InstanceMirror i) { | |
| 112 if (i.reflectee is AutomaticMetadata) | |
| 113 i.reflectee.init(d, this); | |
| 114 }); | |
| 115 }); | |
| 116 } | |
| 117 } | 108 } |
| 118 | 109 |
| 119 class Module : AbstractModule { | 110 class Module : AbstractModule { |
| 120 constructor (Application application, Document document, String url); // O(1) | 111 constructor (Application application, Document document, String url); // O(1) |
| 121 readonly attribute Application application; // O(1) | 112 readonly attribute Application application; // O(1) |
| 122 } | 113 } |
| 123 | 114 |
| 124 class Application : AbstractModule { | 115 class Application : AbstractModule { |
| 125 constructor (Document document, GestureManager gestureManager, String url); //
O(1) | 116 constructor (Document document, GestureManager gestureManager, String url); //
O(1) |
| 126 attribute String title; // O(1) | 117 attribute String title; // O(1) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 150 Where ``name_1`` through ``name_n`` are the names bound to the | 141 Where ``name_1`` through ``name_n`` are the names bound to the |
| 151 various named imports in the script element's document, | 142 various named imports in the script element's document, |
| 152 ``source_code`` is the text content of the script element, | 143 ``source_code`` is the text content of the script element, |
| 153 ``source_module`` is the ``Module`` object of the script element's | 144 ``source_module`` is the ``Module`` object of the script element's |
| 154 module, and ``value_1`` through ``value_n`` are the values | 145 module, and ``value_1`` through ``value_n`` are the values |
| 155 exported by the various named imports in the script element's | 146 exported by the various named imports in the script element's |
| 156 document. | 147 document. |
| 157 | 148 |
| 158 When an import fails to load, the ``as`` name for the import gets | 149 When an import fails to load, the ``as`` name for the import gets |
| 159 bound to ``undefined``. | 150 bound to ``undefined``. |
| OLD | NEW |