| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 final String url; | 93 final String url; |
| 94 | 94 |
| 95 final Root elements; // O(1) | 95 final Root elements; // O(1) |
| 96 // the Root node of the module or application's element tree | 96 // the Root node of the module or application's element tree |
| 97 | 97 |
| 98 external Future<Module> import(String url); // O(Yikes) | 98 external Future<Module> import(String url); // O(Yikes) |
| 99 // load and return the URL at the given Module | 99 // load and return the URL at the given Module |
| 100 // if it's already loaded, the future will resolve immediately | 100 // if it's already loaded, the future will resolve immediately |
| 101 // if loading fails, the future will have an error | 101 // if loading fails, the future will have an error |
| 102 | 102 |
| 103 List<Module> getImports(); // O(N) | 103 external List<Module> getImports(); // O(N) |
| 104 // returns the Module objects of all the imported modules | 104 // returns the Module objects of all the imported modules |
| 105 | 105 |
| 106 external void registerElement(String tagname, Type elementClass); // O(1) | 106 external void registerElement(String tagname, Type elementClass); // O(1) |
| 107 // registers a tag name with the parser | 107 // registers a tag name with the parser |
| 108 // only useful during parse time | 108 // only useful during parse time |
| 109 // verify that tagname isn't null or empty | 109 // verify that tagname isn't null or empty |
| 110 // verify that elementClass is the Type of a class that extends Element (direc
tly or indirectly, but not via "implements" or "with") | 110 // verify that elementClass is the Type of a class that extends Element (direc
tly or indirectly, but not via "implements" or "with") |
| 111 // (see the @tagname code for an example of how to verify that from dart) | 111 // (see the @tagname code for an example of how to verify that from dart) |
| 112 // verify that there's not already a class registered for this tag name | 112 // verify that there's not already a class registered for this tag name |
| 113 // if there is, then mark this tagname is broken, so that it acts as if it's n
ot registered in the parser, | 113 // if there is, then mark this tagname is broken, so that it acts as if it's n
ot registered in the parser, |
| 114 // and, if this is the first time it was marked broken, log a console message
regarding the issue | 114 // and, if this is the first time it was marked broken, log a console message
regarding the issue |
| 115 // (mention the tag name but not the classes, so that it's not observable that
this currently happens out of order) | 115 // (mention the tag name but not the classes, so that it's not observable that
this currently happens out of order) |
| 116 } | 116 } |
| 117 | 117 |
| 118 class Module extends AbstractModule { | 118 class Module extends AbstractModule { |
| 119 Module({String url, Root elements, this.application}) : | 119 Module({String url, Root elements, this.application}) : |
| 120 super(url: url, elements: elements); // O(1) | 120 super(url: url, elements: elements); // O(1) |
| 121 final Application application; // O(1) | 121 final Application application; // O(1) |
| 122 } | 122 } |
| 123 | 123 |
| 124 class Application extends AbstractModule { | 124 class Application extends AbstractModule { |
| 125 Application({String url, Root elements, this.gestureManager}) : | 125 Application({String url, Root elements, this.gestureManager}) : |
| 126 super(url: url, elements: elements); // O(1) | 126 super(url: url, elements: elements); // O(1) |
| 127 external String get title; // O(1) | 127 external String get title; // O(1) |
| 128 external void set title(String newValue); // O(1) | 128 external void set title(String newValue); // O(1) |
| 129 final GestureManager gestureManager; | 129 final GestureManager gestureManager; |
| 130 } | 130 } |
| 131 ``` | 131 ``` |
| OLD | NEW |