| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 } | 135 } |
| 136 | 136 |
| 137 class SelectorQuery { | 137 class SelectorQuery { |
| 138 constructor (String selector); // O(F()) where F() is the complexity of the
selector | 138 constructor (String selector); // O(F()) where F() is the complexity of the
selector |
| 139 | 139 |
| 140 Boolean matches(Element element); // O(F()) | 140 Boolean matches(Element element); // O(F()) |
| 141 Element? find(ParentNode root); // O(N*F()) where N is the number of descend
ants | 141 Element? find(ParentNode root); // O(N*F()) where N is the number of descend
ants |
| 142 Array<Element> findAll(ParentNode root); // O(N*F()) where N is the number o
f descendants | 142 Array<Element> findAll(ParentNode root); // O(N*F()) where N is the number o
f descendants |
| 143 } | 143 } |
| 144 | 144 |
| 145 // Built-in Elements | 145 |
| 146 // BUILT-IN ELEMENTS |
| 147 |
| 146 class ImportElement : Element { | 148 class ImportElement : Element { |
| 147 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants | 149 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants |
| 148 constructor (ChildArguments... nodes); // shorthand | 150 constructor (ChildArguments... nodes); // shorthand |
| 149 constructor (Dictionary attributes); // shorthand | 151 constructor (Dictionary attributes); // shorthand |
| 150 constructor (); // shorthand | 152 constructor (); // shorthand |
| 153 constructor attribute String tagName; // O(1) // "import" |
| 154 constructor attribute Boolean shadow; // O(1) // false |
| 151 } | 155 } |
| 152 class TemplateElement : Element { | 156 class TemplateElement : Element { |
| 153 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants | 157 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants |
| 154 constructor (ChildArguments... nodes); // shorthand | 158 constructor (ChildArguments... nodes); // shorthand |
| 155 constructor (Dictionary attributes); // shorthand | 159 constructor (Dictionary attributes); // shorthand |
| 156 constructor (); // shorthand | 160 constructor (); // shorthand |
| 161 constructor attribute String tagName; // O(1) // "template" |
| 162 constructor attribute Boolean shadow; // O(1) // false |
| 163 |
| 157 readonly attribute DocumentFragment content; // O(1) | 164 readonly attribute DocumentFragment content; // O(1) |
| 158 } | 165 } |
| 159 class ScriptElement : Element { | 166 class ScriptElement : Element { |
| 160 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants | 167 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants |
| 161 constructor (ChildArguments... nodes); // shorthand | 168 constructor (ChildArguments... nodes); // shorthand |
| 162 constructor (Dictionary attributes); // shorthand | 169 constructor (Dictionary attributes); // shorthand |
| 163 constructor (); // shorthand | 170 constructor (); // shorthand |
| 171 constructor attribute String tagName; // O(1) // "script" |
| 172 constructor attribute Boolean shadow; // O(1) // false |
| 164 } | 173 } |
| 165 class StyleElement : Element { | 174 class StyleElement : Element { |
| 166 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants | 175 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants |
| 167 constructor (ChildArguments... nodes); // shorthand | 176 constructor (ChildArguments... nodes); // shorthand |
| 168 constructor (Dictionary attributes); // shorthand | 177 constructor (Dictionary attributes); // shorthand |
| 169 constructor (); // shorthand | 178 constructor (); // shorthand |
| 179 constructor attribute String tagName; // O(1) // "style" |
| 180 constructor attribute Boolean shadow; // O(1) // false |
| 170 } | 181 } |
| 171 class ContentElement : Element { | 182 class ContentElement : Element { |
| 172 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants | 183 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants |
| 173 constructor (ChildArguments... nodes); // shorthand | 184 constructor (ChildArguments... nodes); // shorthand |
| 174 constructor (Dictionary attributes); // shorthand | 185 constructor (Dictionary attributes); // shorthand |
| 175 constructor (); // shorthand | 186 constructor (); // shorthand |
| 187 constructor attribute String tagName; // O(1) // "content" |
| 188 constructor attribute Boolean shadow; // O(1) // false |
| 189 |
| 176 Array<Node> getDistributedNodes(); // O(N) in distributed nodes | 190 Array<Node> getDistributedNodes(); // O(N) in distributed nodes |
| 177 } | 191 } |
| 178 class ImgElement : Element { | 192 class ImgElement : Element { |
| 179 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants | 193 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants |
| 180 constructor (ChildArguments... nodes); // shorthand | 194 constructor (ChildArguments... nodes); // shorthand |
| 181 constructor (Dictionary attributes); // shorthand | 195 constructor (Dictionary attributes); // shorthand |
| 182 constructor (); // shorthand | 196 constructor (); // shorthand |
| 197 constructor attribute String tagName; // O(1) // "img" |
| 198 constructor attribute Boolean shadow; // O(1) // false |
| 199 } |
| 200 class DivElement : Element { |
| 201 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants |
| 202 constructor (ChildArguments... nodes); // shorthand |
| 203 constructor (Dictionary attributes); // shorthand |
| 204 constructor (); // shorthand |
| 205 constructor attribute String tagName; // O(1) // "div" |
| 206 constructor attribute Boolean shadow; // O(1) // false |
| 207 } |
| 208 class SpanElement : Element { |
| 209 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants |
| 210 constructor (ChildArguments... nodes); // shorthand |
| 211 constructor (Dictionary attributes); // shorthand |
| 212 constructor (); // shorthand |
| 213 constructor attribute String tagName; // O(1) // "span" |
| 214 constructor attribute Boolean shadow; // O(1) // false |
| 183 } | 215 } |
| 184 class IframeElement : Element { | 216 class IframeElement : Element { |
| 185 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants | 217 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants |
| 186 constructor (ChildArguments... nodes); // shorthand | 218 constructor (ChildArguments... nodes); // shorthand |
| 187 constructor (Dictionary attributes); // shorthand | 219 constructor (Dictionary attributes); // shorthand |
| 188 constructor (); // shorthand | 220 constructor (); // shorthand |
| 221 constructor attribute String tagName; // O(1) // "iframe" |
| 222 constructor attribute Boolean shadow; // O(1) // false |
| 189 } | 223 } |
| 190 class TElement : Element { | 224 class TElement : Element { |
| 191 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants | 225 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants |
| 192 constructor (ChildArguments... nodes); // shorthand | 226 constructor (ChildArguments... nodes); // shorthand |
| 193 constructor (Dictionary attributes); // shorthand | 227 constructor (Dictionary attributes); // shorthand |
| 194 constructor (); // shorthand | 228 constructor (); // shorthand |
| 229 constructor attribute String tagName; // O(1) // "t" |
| 230 constructor attribute Boolean shadow; // O(1) // false |
| 195 } | 231 } |
| 196 class AElement : Element { | 232 class AElement : Element { |
| 197 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants | 233 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants |
| 198 constructor (ChildArguments... nodes); // shorthand | 234 constructor (ChildArguments... nodes); // shorthand |
| 199 constructor (Dictionary attributes); // shorthand | 235 constructor (Dictionary attributes); // shorthand |
| 200 constructor (); // shorthand | 236 constructor (); // shorthand |
| 237 constructor attribute String tagName; // O(1) // "a" |
| 238 constructor attribute Boolean shadow; // O(1) // false |
| 201 } | 239 } |
| 202 class TitleElement : Element { | 240 class TitleElement : Element { |
| 203 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants | 241 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants |
| 204 constructor (ChildArguments... nodes); // shorthand | 242 constructor (ChildArguments... nodes); // shorthand |
| 205 constructor (Dictionary attributes); // shorthand | 243 constructor (Dictionary attributes); // shorthand |
| 206 constructor (); // shorthand | 244 constructor (); // shorthand |
| 245 constructor attribute String tagName; // O(1) // "title" |
| 246 constructor attribute Boolean shadow; // O(1) // false |
| 247 } |
| 248 class ErrorElement : Element { |
| 249 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants |
| 250 constructor (ChildArguments... nodes); // shorthand |
| 251 constructor (Dictionary attributes); // shorthand |
| 252 constructor (); // shorthand |
| 253 constructor attribute String tagName; // O(1) // "error" |
| 254 constructor attribute Boolean shadow; // O(1) // false |
| 207 } | 255 } |
| 208 | 256 |
| 209 | 257 |
| 210 | 258 |
| 259 // MODULES |
| 260 |
| 211 dictionary ElementRegistration { | 261 dictionary ElementRegistration { |
| 212 String tagName; | 262 String tagName; |
| 213 Boolean shadow = false; | 263 Boolean shadow = false; |
| 214 Object prototype = Element; | 264 Object prototype = Element; |
| 215 } | 265 } |
| 216 | 266 |
| 217 interface ElementConstructor { | 267 interface ElementConstructor { |
| 218 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants | 268 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M =
number of attributes, N = number of nodes plus all their descendants |
| 219 constructor (ChildArguments... nodes); // shorthand | 269 constructor (ChildArguments... nodes); // shorthand |
| 220 constructor (Dictionary attributes); // shorthand | 270 constructor (Dictionary attributes); // shorthand |
| 221 constructor (); // shorthand | 271 constructor (); // shorthand |
| 222 | 272 |
| 223 constructor attribute String tagName; | 273 constructor attribute String tagName; |
| 224 constructor attribute Boolean shadow; | 274 constructor attribute Boolean shadow; |
| 225 } | 275 } |
| 226 | 276 |
| 227 // MODULES | |
| 228 abstract class AbstractModule : EventTarget { | 277 abstract class AbstractModule : EventTarget { |
| 229 readonly attribute Document document; // O(1) // the Documentof the module o
r application | 278 readonly attribute Document document; // O(1) // the Documentof the module o
r application |
| 230 Promise<any> import(String url); // O(Yikes) // returns the module's exports | 279 Promise<any> import(String url); // O(Yikes) // returns the module's exports |
| 231 | 280 |
| 232 readonly attribute String url; | 281 readonly attribute String url; |
| 233 | 282 |
| 234 // createElement() lets you create elements that will be upgraded later when
you register the element | 283 ElementConstructor registerElement(ElementRegistration options); // O(1) |
| 235 Element createElement(String tagName, Dictionary attributes, ChildArguments.
.. nodes); // O(M+N), M = number of attributes, N = number of nodes plus all the
ir descendants | |
| 236 Element createElement(String tagName, Dictionary attributes); // shorthand | |
| 237 Element createElement(String tagName, ChildArguments... nodes); // shorthand | |
| 238 Element createElement(String tagName); // shorthand | |
| 239 | |
| 240 ElementConstructor registerElement(ElementRegistration options); // O(N) in
number of outstanding elements with that tag name to be upgraded | |
| 241 // if you call registerElement() with an object that was created by | 284 // if you call registerElement() with an object that was created by |
| 242 // registerElement(), it just returns the object after registering it, | 285 // registerElement(), it just returns the object after registering it, |
| 243 // rather than creating a new constructor | 286 // rather than creating a new constructor |
| 244 | 287 |
| 245 ScriptElement? currentScript; // O(1) // returns the <script> element curren
tly being executed if any, and if it's in this module; else null | 288 ScriptElement? currentScript; // O(1) // returns the <script> element curren
tly being executed if any, and if it's in this module; else null |
| 246 } | 289 } |
| 247 | 290 |
| 248 class Module : AbstractModule { | 291 class Module : AbstractModule { |
| 249 constructor (Application application, Document document, String url); // O(1
) | 292 constructor (Application application, Document document, String url); // O(1
) |
| 250 readonly attribute Application application; // O(1) | 293 readonly attribute Application application; // O(1) |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 the core mojo fabric JS API sky:mojo:fabric:core | 475 the core mojo fabric JS API sky:mojo:fabric:core |
| 433 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj
o:fabric:ipc | 476 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj
o:fabric:ipc |
| 434 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp
osed sky:mojo:shell | 477 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp
osed sky:mojo:shell |
| 435 the sky API sky:core | 478 the sky API sky:core |
| 436 the sky debug symbols for private APIs sky:debug | 479 the sky debug symbols for private APIs sky:debug |
| 437 ``` | 480 ``` |
| 438 | 481 |
| 439 TODO(ianh): determine if we want to separate the "this" from the | 482 TODO(ianh): determine if we want to separate the "this" from the |
| 440 Document, especially for Modules, so that exposing a module's element | 483 Document, especially for Modules, so that exposing a module's element |
| 441 doesn't expose the module's exports attribute. | 484 doesn't expose the module's exports attribute. |
| OLD | NEW |