OLD | NEW |
1 APIs | 1 APIs |
2 ==== | 2 ==== |
3 | 3 |
4 The Sky core API | 4 The Sky core API |
5 ---------------- | 5 ---------------- |
6 | 6 |
7 ```javascript | 7 ```javascript |
8 module 'sky:core' { | 8 module 'sky:core' { |
9 | 9 |
10 // EVENTS | 10 // EVENTS |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 String getAttribute(String name); // O(N) in number of attributes | 94 String getAttribute(String name); // O(N) in number of attributes |
95 void setAttribute(String name, String value = ''); // O(N) in number of attr
ibutes | 95 void setAttribute(String name, String value = ''); // O(N) in number of attr
ibutes |
96 void removeAttribute(String name); // O(N) in number of attributes | 96 void removeAttribute(String name); // O(N) in number of attributes |
97 | 97 |
98 // Returns a new Array and new Attr instances every time. | 98 // Returns a new Array and new Attr instances every time. |
99 Array<Attr> getAttributes(); // O(N) in number of attributes | 99 Array<Attr> getAttributes(); // O(N) in number of attributes |
100 | 100 |
101 readonly attribute ShadowRoot? shadowRoot; // O(1) // returns the shadow roo
t | 101 readonly attribute ShadowRoot? shadowRoot; // O(1) // returns the shadow roo
t |
102 Array<ContentElement> getDestinationInsertionPoints(); // O(N) in number of
insertion points the node is in | 102 Array<ContentElement> getDestinationInsertionPoints(); // O(N) in number of
insertion points the node is in |
103 | 103 |
| 104 virtual void endTagParsedCallback(); // noop |
104 virtual void attributeChangeCallback(String name, String? oldValue, String?
newValue); // noop | 105 virtual void attributeChangeCallback(String name, String? oldValue, String?
newValue); // noop |
105 // TODO(ianh): does a node ever need to know when it's been redistributed? | 106 // TODO(ianh): does a node ever need to know when it's been redistributed? |
106 } | 107 } |
107 | 108 |
108 class Text : Node { | 109 class Text : Node { |
109 constructor (String value = ''); // O(1) | 110 constructor (String value = ''); // O(1) |
110 attribute String value; // O(1) | 111 attribute String value; // O(1) |
111 | 112 |
112 void replaceWith(String node); // O(1) // special case override of Node.repl
aceWith() | 113 void replaceWith(String node); // O(1) // special case override of Node.repl
aceWith() |
113 | 114 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 abstract class AbstractModule : EventTarget { | 278 abstract class AbstractModule : EventTarget { |
278 readonly attribute Document document; // O(1) // the Documentof the module o
r application | 279 readonly attribute Document document; // O(1) // the Documentof the module o
r application |
279 Promise<any> import(String url); // O(Yikes) // returns the module's exports | 280 Promise<any> import(String url); // O(Yikes) // returns the module's exports |
280 | 281 |
281 readonly attribute String url; | 282 readonly attribute String url; |
282 | 283 |
283 ElementConstructor registerElement(ElementRegistration options); // O(1) | 284 ElementConstructor registerElement(ElementRegistration options); // O(1) |
284 // if you call registerElement() with an object that was created by | 285 // if you call registerElement() with an object that was created by |
285 // registerElement(), it just returns the object after registering it, | 286 // registerElement(), it just returns the object after registering it, |
286 // rather than creating a new constructor | 287 // rather than creating a new constructor |
| 288 // otherwise, it proceeds as follows: |
| 289 // 0. let prototype be the prototype passed in (defaulting to Element) |
| 290 // 1. let constructor be prototype.constructor |
| 291 // 2. create a new Function that: |
| 292 // 0. throws if not called as a constructor |
| 293 // 1. initialises the shadow tree is shadow on the options is true |
| 294 // 2. calls constructor, if it's not null, with the module as the argum
ent |
| 295 // 3. let that new Function's prototype be the aforementioned prototype |
| 296 // 4. let that new Function have tagName and shadow properties set to |
| 297 // the values passed in |
287 | 298 |
288 ScriptElement? currentScript; // O(1) // returns the <script> element curren
tly being executed if any, and if it's in this module; else null | 299 ScriptElement? currentScript; // O(1) // returns the <script> element curren
tly being executed if any, and if it's in this module; else null |
289 } | 300 } |
290 | 301 |
291 class Module : AbstractModule { | 302 class Module : AbstractModule { |
292 constructor (Application application, Document document, String url); // O(1
) | 303 constructor (Application application, Document document, String url); // O(1
) |
293 readonly attribute Application application; // O(1) | 304 readonly attribute Application application; // O(1) |
294 | 305 |
295 attribute any exports; // O(1) // defaults to the module's document | 306 attribute any exports; // O(1) // defaults to the module's document |
296 } | 307 } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 the core mojo fabric JS API sky:mojo:fabric:core | 486 the core mojo fabric JS API sky:mojo:fabric:core |
476 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj
o:fabric:ipc | 487 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj
o:fabric:ipc |
477 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp
osed sky:mojo:shell | 488 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp
osed sky:mojo:shell |
478 the sky API sky:core | 489 the sky API sky:core |
479 the sky debug symbols for private APIs sky:debug | 490 the sky debug symbols for private APIs sky:debug |
480 ``` | 491 ``` |
481 | 492 |
482 TODO(ianh): determine if we want to separate the "this" from the | 493 TODO(ianh): determine if we want to separate the "this" from the |
483 Document, especially for Modules, so that exposing a module's element | 494 Document, especially for Modules, so that exposing a module's element |
484 doesn't expose the module's exports attribute. | 495 doesn't expose the module's exports attribute. |
OLD | NEW |