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

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

Issue 695423004: Specs: Drop the concept of late-bound elements. An element can never be upgraded. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/markup.md ('k') | sky/specs/parsing.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:
11 11
12 ```html 12 ```html
13 <import src="path/to/module.sky" /> 13 <import src="path/to/module.sky" />
14 ``` 14 ```
15 15
16 As these ```import``` elements are inserted into a document, the 16 As these ```import``` elements are inserted into a document, the
17 document's list of outstanding dependencies grows. When an imported 17 document's list of outstanding dependencies grows. When an imported
18 module completes, it is removed from the document's list of 18 module completes, it is removed from the document's list of
19 outstanding dependencies. 19 outstanding dependencies.
20 20
21 Before executing any ```script``` elements, the parser waits until the 21 Before executing script or inserting an element that is not already
22 list of outstanding dependencies is empty. After the parser has 22 registered, the parser waits until the list of outstanding
23 finished parsing, the document waits until its list of outstanding 23 dependencies is empty. After the parser has finished parsing, the
24 dependencies is empty before the module it represents is marked 24 document waits until its list of outstanding dependencies is empty
25 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 that represents the module: 32 the [```Module``` object](apis.md) that represents the module.
33
34 ```javascript
35 interface Module : EventTarget {
36 constructor (Application application, Document document); // O(1)
37 attribute any exports; // O(1) // defaults to the module's document
38 readonly attribute Document document; // O(1) // the module's document
39 readonly attribute Application application; // O(1)
40 }
41 ```
42 33
43 ### Exporting values ### 34 ### Exporting values ###
44 35
45 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
46 its ```Module``` object. By default, the ```exports``` property of a 37 its ```Module``` object. By default, the ```exports``` property of a
47 ```Module``` is its ```Document``` object, so that a script-less 38 ```Module``` is its ```Document``` object, so that a script-less
48 import is still useful (it exposes its contents, e.g. templates that 39 import is still useful (it exposes its contents, e.g. templates that
49 the import might have been written to provide). 40 the import might have been written to provide).
50 41
51 ### Exporting element definitions ### 42 ### Exporting element definitions ###
(...skipping 25 matching lines...) Expand all
77 Where ```name_1``` through ```name_n``` are the names bound to the 68 Where ```name_1``` through ```name_n``` are the names bound to the
78 various named imports in the script element's document, 69 various named imports in the script element's document,
79 ```source_code``` is the text content of the script element, 70 ```source_code``` is the text content of the script element,
80 ```source_module`` is the ```Module``` object of the script element's 71 ```source_module`` is the ```Module``` object of the script element's
81 module, and ```value_1``` through ```value_n``` are the values 72 module, and ```value_1``` through ```value_n``` are the values
82 exported by the various named imports in the script element's 73 exported by the various named imports in the script element's
83 document. 74 document.
84 75
85 When an import fails to load, the ```as``` name for the import gets 76 When an import fails to load, the ```as``` name for the import gets
86 bound to ```undefined```. 77 bound to ```undefined```.
OLDNEW
« no previous file with comments | « sky/specs/markup.md ('k') | sky/specs/parsing.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698