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

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

Issue 752093003: Specs: clean up event listeners a bit. Drop the pointless (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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
12 class Event { 12 class Event {
13 constructor (String type, Boolean bubbles = true, any data = null); // O(1) 13 constructor (String type, Boolean bubbles = true, any data = null); // O(1)
14 readonly attribute String type; // O(1) 14 readonly attribute String type; // O(1)
15 readonly attribute Boolean bubbles; // O(1) 15 readonly attribute Boolean bubbles; // O(1)
16 attribute any data; // O(1) 16 attribute any data; // O(1)
17 17
18 readonly attribute EventTarget target; // O(1) 18 readonly attribute EventTarget target; // O(1)
19 void preventDefault(); // O(1) 19 attribute Boolean handled; // O(1)
20 attribute any result; // O(1) // defaults to undefined 20 attribute any result; // O(1)
21 21
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 get 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);
27 // if the return value is not undefined:
28 // assign it to event.result
29 // set event.handled to true
27 30
28 abstract class EventTarget { 31 abstract class EventTarget {
29 any dispatchEvent(Event event); // O(N) in total number of listeners for thi s type in the chain // returns Event.result 32 any dispatchEvent(Event event); // O(N) in total number of listeners for thi s type in the chain
33 // sets event.handled to false and event.result to undefined
34 // makes a record of the event target chain
35 // invokes all the handlers on the chain in turn
36 // returns event.result
30 void addEventListener(String type, EventListener listener); // O(1) 37 void addEventListener(String type, EventListener listener); // O(1)
31 void removeEventListener(String type, EventListener listener); // O(N) in ev ent listeners with that type 38 void removeEventListener(String type, EventListener listener); // O(N) in ev ent listeners with that type
32 private Array<String> getRegisteredEventListenerTypes(); // O(N) 39 private Array<String> getRegisteredEventListenerTypes(); // O(N)
33 private Array<EventListener> getRegisteredEventListenersForType(String type) ; // O(N) 40 private Array<EventListener> getRegisteredEventListenersForType(String type) ; // O(N)
34 } 41 }
35 42
36 class CustomEventTarget : EventTarget { 43 class CustomEventTarget : EventTarget {
37 constructor (); // O(1) 44 constructor (); // O(1)
38 attribute EventTarget parentNode; // getter O(1), setter O(N) in height of t ree, throws if this would make a loop 45 attribute EventTarget parentNode; // getter O(1), setter O(N) in height of t ree, throws if this would make a loop
39 46
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 the core mojo fabric JS API sky:mojo:fabric:core 502 the core mojo fabric JS API sky:mojo:fabric:core
496 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj o:fabric:ipc 503 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj o:fabric:ipc
497 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp osed sky:mojo:shell 504 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp osed sky:mojo:shell
498 the sky API sky:core 505 the sky API sky:core
499 the sky debug symbols for private APIs sky:debug 506 the sky debug symbols for private APIs sky:debug
500 ``` 507 ```
501 508
502 TODO(ianh): determine if we want to separate the "this" from the 509 TODO(ianh): determine if we want to separate the "this" from the
503 Document, especially for Modules, so that exposing a module's element 510 Document, especially for Modules, so that exposing a module's element
504 doesn't expose the module's exports attribute. 511 doesn't expose the module's exports attribute.
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698