| 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
|
| --------------
|
|
|