Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: sky/specs/modules.md

Issue 884713009: Specs: dartification of dom.md, more work on script.md; this is highly work-in-progress and hasn't … (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/specs/gestures.md ('k') | sky/specs/pointer.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 The ``<script>`` elements found in the document create the subsequent 45 The ``<script>`` elements found in the document create the subsequent
46 libraries. Each one first imports the ``dart:mirror`` library, then 46 libraries. Each one first imports the ``dart:mirror`` library, then
47 the ``sky:core`` module, then the first library described above, then 47 the ``sky:core`` module, then the first library described above, then
48 all the modules referenced by ``<import>`` element up to that 48 all the modules referenced by ``<import>`` element up to that
49 ``<script>`` element and all the libraries defined by ``<script>`` 49 ``<script>`` element and all the libraries defined by ``<script>``
50 elements up to that point, interleaved so as to maintain the same 50 elements up to that point, interleaved so as to maintain the same
51 relative order as those elements were first seen by the parser. 51 relative order as those elements were first seen by the parser.
52 52
53 When a library imports a module, it actually imports all the libraries 53 When a library imports a module, it actually imports all the libraries
54 that were declared by that module except the element tree library. 54 that were declared by that module except the aforementioned element
55 tree library.
55 56
56 At the end of the ``<script>`` block's source, if it parsed correctly 57 At the end of the ``<script>`` block's source, if it parsed correctly
57 and completely, the following code is appended: 58 and completely, the following code is appended:
58 59
59 ```dart 60 ```dart
60 class _ { } 61 class _ { }
61 module.registerElements(reflectClass(_).owner); 62 module.registerElements(reflectClass(_).owner);
62 ``` 63 ```
63 64
64 TODO(ianh): decide what URL and name we should give the libraries, as 65 TODO(ianh): decide what URL and name we should give the libraries, as
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // - append all the specified children 140 // - append all the specified children
140 // - mark that new Function as created by registerElement() so that 141 // - mark that new Function as created by registerElement() so that
141 // it can be recognised if used as an argument to 142 // it can be recognised if used as an argument to
142 // registerElement() 143 // registerElement()
143 // - let that new Function's prototype be the aforementioned prototype 144 // - let that new Function's prototype be the aforementioned prototype
144 // - let that new Function have tagName and shadow properties set to 145 // - let that new Function have tagName and shadow properties set to
145 // the aforementioned tagName and shadow 146 // the aforementioned tagName and shadow
146 // - register the new tagName with this constructor 147 // - register the new tagName with this constructor
147 // - return the new Function (which is, not coincidentally, an 148 // - return the new Function (which is, not coincidentally, an
148 // InternalElementConstructorWithShadow) 149 // InternalElementConstructorWithShadow)
149
150 readonly attribute ScriptElement? currentScript; // O(1) // returns the <scrip t> element currently being executed if any, and if it's in this module; else nul l
151 } 150 }
152 151
153 class Module : AbstractModule { 152 class Module : AbstractModule {
154 constructor (Application application, Document document, String url); // O(1) 153 constructor (Application application, Document document, String url); // O(1)
155 readonly attribute Application application; // O(1) 154 readonly attribute Application application; // O(1)
156
157 attribute any exports; // O(1) // defaults to {}
158 } 155 }
159 156
160 class Application : AbstractModule { 157 class Application : AbstractModule {
161 constructor (Document document, GestureManager gestureManager, String url); // O(1) 158 constructor (Document document, GestureManager gestureManager, String url); // O(1)
162 attribute String title; // O(1) 159 attribute String title; // O(1)
163 readonly attribute GestureManager gestureManager; 160 readonly attribute GestureManager gestureManager;
164 } 161 }
165 ``` 162 ```
166 163
167 164
(...skipping 18 matching lines...) Expand all
186 Where ``name_1`` through ``name_n`` are the names bound to the 183 Where ``name_1`` through ``name_n`` are the names bound to the
187 various named imports in the script element's document, 184 various named imports in the script element's document,
188 ``source_code`` is the text content of the script element, 185 ``source_code`` is the text content of the script element,
189 ``source_module`` is the ``Module`` object of the script element's 186 ``source_module`` is the ``Module`` object of the script element's
190 module, and ``value_1`` through ``value_n`` are the values 187 module, and ``value_1`` through ``value_n`` are the values
191 exported by the various named imports in the script element's 188 exported by the various named imports in the script element's
192 document. 189 document.
193 190
194 When an import fails to load, the ``as`` name for the import gets 191 When an import fails to load, the ``as`` name for the import gets
195 bound to ``undefined``. 192 bound to ``undefined``.
OLDNEW
« no previous file with comments | « sky/specs/gestures.md ('k') | sky/specs/pointer.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698