| OLD | NEW |
| 1 Sky Event Model | 1 Sky Event Model |
| 2 =============== | 2 =============== |
| 3 | 3 |
| 4 ```dart | 4 ```dart |
| 5 import 'dart:collection'; | 5 import 'dart:collection'; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 | 7 |
| 8 class ExceptionAndStackTrace<T> { | 8 class ExceptionAndStackTrace<T> { |
| 9 const ExceptionAndStackTrace(this.exception, this.stackTrace); | 9 const ExceptionAndStackTrace(this.exception, this.stackTrace); |
| 10 final T exception; | 10 final T exception; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // TODO(ianh): do events get retargetted, e.g. focus when leaving a custom ele
ment? | 138 // TODO(ianh): do events get retargetted, e.g. focus when leaving a custom ele
ment? |
| 139 // e.g. sent from inside a shadow tree, when exiting the shadow tree, focus ev
ent should: | 139 // e.g. sent from inside a shadow tree, when exiting the shadow tree, focus ev
ent should: |
| 140 // - disappear if we're moving from one to another element | 140 // - disappear if we're moving from one to another element |
| 141 // - be targetted if it's going to another node in a different scope | 141 // - be targetted if it's going to another node in a different scope |
| 142 } | 142 } |
| 143 | 143 |
| 144 class EventTarget { | 144 class EventTarget { |
| 145 EventTarget() : _eventsController = new DispatcherController<Event>(); | 145 EventTarget() : _eventsController = new DispatcherController<Event>(); |
| 146 | 146 |
| 147 Dispatcher get events => _eventsController.dispatcher; | 147 Dispatcher get events => _eventsController.dispatcher; |
| 148 EventTarget parentNode; | 148 EventTarget get parentNode; |
| 149 | 149 |
| 150 List<EventTarget> getEventDispatchChain() { | 150 List<EventTarget> getEventDispatchChain() { |
| 151 if (this.parentNode == null) { | 151 if (this.parentNode == null) { |
| 152 return [this]; | 152 return [this]; |
| 153 } else { | 153 } else { |
| 154 var result = this.parentNode.getEventDispatchChain(); | 154 var result = this.parentNode.getEventDispatchChain(); |
| 155 result.insert(0, this); | 155 result.insert(0, this); |
| 156 return result; | 156 return result; |
| 157 } | 157 } |
| 158 } | 158 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 183 throw exceptions; | 183 throw exceptions; |
| 184 return event.result; | 184 return event.result; |
| 185 } | 185 } |
| 186 | 186 |
| 187 void _dispatchEventLocally(Event event) { | 187 void _dispatchEventLocally(Event event) { |
| 188 event._currentTarget = this; | 188 event._currentTarget = this; |
| 189 _eventsController.add(event); | 189 _eventsController.add(event); |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 ``` | 192 ``` |
| OLD | NEW |