OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
6 | 6 |
7 /** | 7 /** |
8 * Base class that supports listening for and dispatching browser events. | 8 * Base class that supports listening for and dispatching browser events. |
9 * | 9 * |
10 * Normally events are accessed via the Stream getter: | 10 * Normally events are accessed via the Stream getter: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 Stream operator [](String type) { | 49 Stream operator [](String type) { |
50 return new _EventStream(_ptr, type, false); | 50 return new _EventStream(_ptr, type, false); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 class ElementEvents extends Events { | 54 class ElementEvents extends Events { |
55 /* Raw event target. */ | 55 /* Raw event target. */ |
56 final Element _ptr; | 56 final Element _ptr; |
57 static final webkitEvents = { | 57 static final webkitEvents = { |
58 'animationend' : 'webkitAnimationEnd', | 58 'animationend' : 'webkitAnimationEnd', |
59 'animationiteration' : 'webkitAnimationIteration', | 59 'animationiteration' : 'webkitAnimationIteration', |
60 'animationstart' : 'webkitAnimationStart', | 60 'animationstart' : 'webkitAnimationStart', |
61 'fullscreenchange' : 'webkitfullscreenchange', | 61 'fullscreenchange' : 'webkitfullscreenchange', |
62 'fullscreenerror' : 'webkitfullscreenerror', | 62 'fullscreenerror' : 'webkitfullscreenerror', |
63 'keyadded' : 'webkitkeyadded', | 63 'keyadded' : 'webkitkeyadded', |
64 'keyerror' : 'webkitkeyerror', | 64 'keyerror' : 'webkitkeyerror', |
65 'keymessage' : 'webkitkeymessage', | 65 'keymessage' : 'webkitkeymessage', |
66 'needkey' : 'webkitneedkey', | 66 'needkey' : 'webkitneedkey', |
67 'pointerlockchange' : 'webkitpointerlockchange', | 67 'pointerlockchange' : 'webkitpointerlockchange', |
68 'pointerlockerror' : 'webkitpointerlockerror', | 68 'pointerlockerror' : 'webkitpointerlockerror', |
69 'resourcetimingbufferfull' : 'webkitresourcetimingbufferfull', | 69 'resourcetimingbufferfull' : 'webkitresourcetimingbufferfull', |
70 'transitionend': 'webkitTransitionEnd', | 70 'transitionend': 'webkitTransitionEnd', |
71 'speechchange' : 'webkitSpeechChange' | 71 'speechchange' : 'webkitSpeechChange' |
72 }; | 72 }; |
73 | 73 |
74 ElementEvents(Element ptr) : this._ptr = ptr, super(ptr); | 74 ElementEvents(Element ptr) : this._ptr = ptr, super(ptr); |
75 | 75 |
76 Stream operator [](String type) { | 76 Stream operator [](String type) { |
77 if (webkitEvents.keys.contains(type.toLowerCase())) { | 77 if (webkitEvents.keys.contains(type.toLowerCase())) { |
78 if (Device.isWebKit) { | 78 if (Device.isWebKit) { |
79 return new _ElementEventStreamImpl( | 79 return new _ElementEventStreamImpl( |
(...skipping 15 matching lines...) Expand all Loading... |
95 // Custom element created callback. | 95 // Custom element created callback. |
96 EventTarget._created(); | 96 EventTarget._created(); |
97 | 97 |
98 /** | 98 /** |
99 * This is an ease-of-use accessor for event streams which should only be | 99 * This is an ease-of-use accessor for event streams which should only be |
100 * used when an explicit accessor is not available. | 100 * used when an explicit accessor is not available. |
101 */ | 101 */ |
102 Events get on => new Events(this); | 102 Events get on => new Events(this); |
103 $!MEMBERS | 103 $!MEMBERS |
104 } | 104 } |
OLD | NEW |