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

Unified Diff: sky/specs/modules.md

Issue 824773002: Specs: Split apis.md into dom.md, events.md, idl.md, and move the remainder into README.md and modu… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/specs/idl.md ('k') | sky/specs/runloop.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/specs/modules.md
diff --git a/sky/specs/modules.md b/sky/specs/modules.md
index fcd28790adb8f123436efa3d5a07d99dcd8bc743..cad32ce2ea7988c3948010bd1a54cad2eaedf818 100644
--- a/sky/specs/modules.md
+++ b/sky/specs/modules.md
@@ -47,6 +47,50 @@ the imported module's ``exports`` value, and for each property that is
an element constructor (generated by ``registerElement()``), it adds
an element to the importee's element registry.
+### IDL ###
+
+```javascript
+abstract class AbstractModule : EventTarget {
+ readonly attribute Document document; // O(1) // the Documentof the module or application
+ Promise<any> import(String url); // O(Yikes) // returns the module's exports
+ private Array<Module> getImports(); O(N) // returns the Module objects of all the imported modules
+
+ readonly attribute String url;
+
+ ElementConstructor registerElement(ElementRegistration options); // O(1)
+ // if you call registerElement() with an object that was created by
+ // registerElement(), it just returns the object after registering it,
+ // rather than creating a new constructor
+ // otherwise, it proceeds as follows:
+ // 1. let constructor be the constructor passed in, if any
+ // 2. let prototype be the constructor's prototype; if there is no
+ // constructor, let prototype be Element
+ // 3. create a new Function that:
+ // 1. throws if not called as a constructor
+ // 2. creates an actual Element object
+ // 3. initialises the shadow tree if shadow on the options is true
+ // 4. calls constructor, if it's not null, with the module as the argument
+ // 4. let that new Function's prototype be the aforementioned prototype
+ // 5. let that new Function have tagName and shadow properties set to
+ // the values passed in on options
+ // 6. register the new element
+
+ readonly attribute ScriptElement? currentScript; // O(1) // returns the <script> element currently being executed if any, and if it's in this module; else null
+}
+
+class Module : AbstractModule {
+ constructor (Application application, Document document, String url); // O(1)
+ readonly attribute Application application; // O(1)
+
+ attribute any exports; // O(1) // defaults to {}
+}
+
+class Application : AbstractModule {
+ constructor (Document document, String url); // O(1)
+ attribute String title; // O(1)
+}
+```
+
Naming modules
--------------
« no previous file with comments | « sky/specs/idl.md ('k') | sky/specs/runloop.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698