| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 /** | 86 /** |
| 87 * @override | 87 * @override |
| 88 * @param {symbol} eventType | 88 * @param {symbol} eventType |
| 89 * @param {*=} eventData | 89 * @param {*=} eventData |
| 90 */ | 90 */ |
| 91 dispatchEventToListeners(eventType, eventData) { | 91 dispatchEventToListeners(eventType, eventData) { |
| 92 if (!this._listeners || !this._listeners.has(eventType)) | 92 if (!this._listeners || !this._listeners.has(eventType)) |
| 93 return; | 93 return; |
| 94 | 94 |
| 95 var event = new Common.Event(this, eventData); | 95 var event = new Common.Event(eventData); |
| 96 var listeners = this._listeners.get(eventType).slice(0); | 96 var listeners = this._listeners.get(eventType).slice(0); |
| 97 for (var i = 0; i < listeners.length; ++i) | 97 for (var i = 0; i < listeners.length; ++i) |
| 98 listeners[i].listener.call(listeners[i].thisObject, event); | 98 listeners[i].listener.call(listeners[i].thisObject, event); |
| 99 } | 99 } |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 /** | 102 /** |
| 103 * @unrestricted | 103 * @unrestricted |
| 104 */ | 104 */ |
| 105 Common.Event = class { | 105 Common.Event = class { |
| 106 /** | 106 /** |
| 107 * @param {!Common.EventTarget} target | |
| 108 * @param {*=} data | 107 * @param {*=} data |
| 109 */ | 108 */ |
| 110 constructor(target, data) { | 109 constructor(data) { |
| 111 this.target = target; | |
| 112 this.data = data; | 110 this.data = data; |
| 113 } | 111 } |
| 114 }; | 112 }; |
| 115 | 113 |
| 116 /** | 114 /** |
| 117 * @interface | 115 * @interface |
| 118 */ | 116 */ |
| 119 Common.EventTarget = function() {}; | 117 Common.EventTarget = function() {}; |
| 120 | 118 |
| 121 /** | 119 /** |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 * @param {(!Object|undefined)} receiver | 169 * @param {(!Object|undefined)} receiver |
| 172 * @param {function(?):?} method | 170 * @param {function(?):?} method |
| 173 */ | 171 */ |
| 174 constructor(eventTarget, eventType, receiver, method) { | 172 constructor(eventTarget, eventType, receiver, method) { |
| 175 this.eventTarget = eventTarget; | 173 this.eventTarget = eventTarget; |
| 176 this.eventType = eventType; | 174 this.eventType = eventType; |
| 177 this.receiver = receiver; | 175 this.receiver = receiver; |
| 178 this.method = method; | 176 this.method = method; |
| 179 } | 177 } |
| 180 }; | 178 }; |
| OLD | NEW |