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

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

Issue 687353003: Specs: Add a way for the inspector to see the registered event listeners (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/README.md ('k') | sky/specs/modules.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 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
11 11
(...skipping 10 matching lines...) Expand all
22 // TODO(ianh): do events get blocked at scope boundaries, e.g. focus events when both sides are in the scope? 22 // TODO(ianh): do events get blocked at scope boundaries, e.g. focus events when both sides are in the scope?
23 // TODO(ianh): do events ger retargetted, e.g. focus when leaving a custom e lement? 23 // TODO(ianh): do events ger retargetted, e.g. focus when leaving a custom e lement?
24 } 24 }
25 25
26 callback EventListener any (Event event); // return value is assigned to Event .result 26 callback EventListener any (Event event); // return value is assigned to Event .result
27 27
28 interface EventTarget { 28 interface EventTarget {
29 any dispatchEvent(Event event); // O(N) in total number of listeners for thi s type in the chain // returns Event.result 29 any dispatchEvent(Event event); // O(N) in total number of listeners for thi s type in the chain // returns Event.result
30 void addEventListener(String type, EventListener listener); // O(1) 30 void addEventListener(String type, EventListener listener); // O(1)
31 void removeEventListener(String type, EventListener listener); // O(N) in ev ent listeners with that type 31 void removeEventListener(String type, EventListener listener); // O(N) in ev ent listeners with that type
32 private Array<String> getRegisteredEventListenerTypes(); // O(N)
33 private Array<EventListener> getRegisteredEventListenersForType(String type) ; // O(N)
32 } 34 }
33 35
34 interface CustomEventTarget : EventTarget { 36 interface CustomEventTarget : EventTarget {
35 constructor (); // O(1) 37 constructor (); // O(1)
36 attribute EventTarget parentNode; // getter O(1), setter O(N) in height of t ree, throws if this would make a loop 38 attribute EventTarget parentNode; // getter O(1), setter O(N) in height of t ree, throws if this would make a loop
37 39
38 // you can inherit from this to make your object into an event target 40 // you can inherit from this to make your object into an event target
39 } 41 }
40 42
41 43
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 ReturnType method(); 250 ReturnType method();
249 // When the platform calls this method, it always invokes the "real" metho d, even if it's been 251 // When the platform calls this method, it always invokes the "real" metho d, even if it's been
250 // deleted from the prototypes (as if it took a reference to the method at startup, and stored 252 // deleted from the prototypes (as if it took a reference to the method at startup, and stored
251 // state using Symbols) 253 // state using Symbols)
252 virtual ReturnType methodCallback(); 254 virtual ReturnType methodCallback();
253 // when the platform calls this, it actually calls it the way JS would, so author overrides do 255 // when the platform calls this, it actually calls it the way JS would, so author overrides do
254 // affect what gets called. Make sure if you override it that you call the superclass implementation! 256 // affect what gets called. Make sure if you override it that you call the superclass implementation!
255 // The default implementations of 'virtual' methods all end by calling the identically named method 257 // The default implementations of 'virtual' methods all end by calling the identically named method
256 // on the superclass, if there is such a method. 258 // on the superclass, if there is such a method.
257 259
260 // private APIs - see below
261 private void method();
262
258 // arguments and overloading are done as follows 263 // arguments and overloading are done as follows
259 // note that the argument names are only for documentation purposes 264 // note that the argument names are only for documentation purposes
260 ReturnType method(ArgumentType argumentName1, ArgumentType argumentName2); 265 ReturnType method(ArgumentType argumentName1, ArgumentType argumentName2);
261 // the last argument's type can have "..." appended to it to indicate a vara rgs-like situation 266 // the last argument's type can have "..." appended to it to indicate a vara rgs-like situation
262 ReturnType method(ArgumentType argumentName1, ArgumentType... allSubsequentA rguments); 267 ReturnType method(ArgumentType argumentName1, ArgumentType... allSubsequentA rguments);
263 } 268 }
264 269
265 // the module can have properties and methods also 270 // the module can have properties and methods also
266 attribute String Foo; 271 attribute String Foo;
267 void method(); 272 void method();
268 273
269 } 274 }
270 ``` 275 ```
271 276
277 ### Private APIs ###
278
279 Private APIs are only accessible via Symbol objects, which are then
280 exposed on the sky:debug module's exports object as the name of the
281 member given in the IDL.
282
283 For example, consider:
284
285 ```javascript
286 interface Foo {
287 private void Bar();
288 }
289 ```
290
291 In a script with a ``foo`` object of type ``Foo``, ``foo.Bar`` is
292 undefined. However, it can be obtained as follows:
293
294 ```html
295 <import src="sky:debug" as="debug"/>
296 <!-- ... import whatever defines 'foo' ... -->
297 <script>
298 foo[debug.Bar]
299 </script>
300 ```
301
302 ### Types ###
303
272 The following types are available: 304 The following types are available:
273 305
274 * ``Integer`` - WebIDL ``long long`` 306 * ``Integer`` - WebIDL ``long long``
275 * ``Float`` - WebIDL ``double`` 307 * ``Float`` - WebIDL ``double``
276 * ``String`` - WebIDL ``USVString`` 308 * ``String`` - WebIDL ``USVString``
277 * ``Boolean`` - WebIDL ``boolean`` 309 * ``Boolean`` - WebIDL ``boolean``
278 # ``Object`` - WebIDL ``object`` 310 # ``Object`` - WebIDL ``object``
279 * ``InterfaceName`` - an instance of the interface InterfaceName 311 * ``InterfaceName`` - an instance of the interface InterfaceName
280 * ``Promise<Type>`` - WebIDL ``Promise<T>`` 312 * ``Promise<Type>`` - WebIDL ``Promise<T>``
281 * ``Array<Type>`` - WebIDL ``sequence<T>`` 313 * ``Array<Type>`` - WebIDL ``sequence<T>``
282 * ``Dictionary`` - unordered set of name-value String-String pairs with no dupli cate names 314 * ``Dictionary`` - unordered set of name-value String-String pairs with no dupli cate names
283 * ``Type?`` - union of Type and the singleton type with value "null" (WebIDL nul lable) 315 * ``Type?`` - union of Type and the singleton type with value "null" (WebIDL nul lable)
284 * ``(Type1 or Type2)`` - union of Type1 and Type2 (WebIDL union) 316 * ``(Type1 or Type2)`` - union of Type1 and Type2 (WebIDL union)
285 * ``any`` - union of all types (WebIDL ``any``) 317 * ``any`` - union of all types (WebIDL ``any``)
286 318
287 Methods that return nothing (undefined, in JS) use the keyword "void" 319 Methods that return nothing (undefined, in JS) use the keyword "void"
288 instead of a type. 320 instead of a type.
289 321
290 TODO(ianh): Figure out what should happen with omitted and extraneous parameters 322 TODO(ianh): Figure out what should happen with omitted and extraneous parameters
291 323
292 TODO(ianh): Define in detail how this actually works 324 TODO(ianh): Define in detail how this actually works
293 325
326
294 Mojom IDL 327 Mojom IDL
295 --------- 328 ---------
296 329
297 The Mojom IDL language is used to describe the APIs exposed over Mojo 330 The Mojom IDL language is used to describe the APIs exposed over Mojo
298 pipes. 331 pipes.
299 332
300 Mojom IDL definitions are typically compiled to wrappers in each 333 Mojom IDL definitions are typically compiled to wrappers in each
301 language, which are then used as imports. 334 language, which are then used as imports.
302 335
303 TODO(ianh): Define in detail how this actually works 336 TODO(ianh): Define in detail how this actually works
304 337
305 338
306 Notes 339 Notes
307 ----- 340 -----
308 ```javascript 341 ```javascript
309 global object = {} // with Math, RegExp, etc 342 global object = {} // with Math, RegExp, etc
310 343
311 magical imports: 344 magical imports:
312 the core mojo fabric JS API sky:mojo:fabric:core 345 the core mojo fabric JS API sky:mojo:fabric:core
313 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj o:fabric:ipc 346 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj o:fabric:ipc
314 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp osed sky:mojo:shell 347 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp osed sky:mojo:shell
315 the sky API sky:core 348 the sky API sky:core
349 the sky debug symbols for private APIs sky:debug
316 ``` 350 ```
317 351
318 TODO(ianh): determine if we want to separate the "this" from the 352 TODO(ianh): determine if we want to separate the "this" from the
319 Document, especially for Modules, so that exposing a module's element 353 Document, especially for Modules, so that exposing a module's element
320 doesn't expose the module's exports attribute. 354 doesn't expose the module's exports attribute.
OLDNEW
« no previous file with comments | « sky/specs/README.md ('k') | sky/specs/modules.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698