OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/base/event_target.html"> | 8 <link rel="import" href="/tracing/base/event_target.html"> |
9 | 9 |
10 <script> | 10 <script> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 Event = TrEvent; | 70 Event = TrEvent; |
71 } | 71 } |
72 | 72 |
73 /** | 73 /** |
74 * Dispatches a simple event on an event target. | 74 * Dispatches a simple event on an event target. |
75 * @param {!EventTarget} target The event target to dispatch the event on. | 75 * @param {!EventTarget} target The event target to dispatch the event on. |
76 * @param {string} type The type of the event. | 76 * @param {string} type The type of the event. |
77 * @param {boolean=} opt_bubbles Whether the event bubbles or not. | 77 * @param {boolean=} opt_bubbles Whether the event bubbles or not. |
78 * @param {boolean=} opt_cancelable Whether the default action of the event | 78 * @param {boolean=} opt_cancelable Whether the default action of the event |
79 * can be prevented. | 79 * can be prevented. |
| 80 * @param {!Object=} opt_fields |
| 81 * |
80 * @return {boolean} If any of the listeners called {@code preventDefault} | 82 * @return {boolean} If any of the listeners called {@code preventDefault} |
81 * during the dispatch this will return false. | 83 * during the dispatch this will return false. |
82 */ | 84 */ |
83 function dispatchSimpleEvent(target, type, opt_bubbles, opt_cancelable) { | 85 function dispatchSimpleEvent(target, type, opt_bubbles, opt_cancelable, |
| 86 opt_fields) { |
84 var e = new tr.b.Event(type, opt_bubbles, opt_cancelable); | 87 var e = new tr.b.Event(type, opt_bubbles, opt_cancelable); |
| 88 if (opt_fields) { |
| 89 tr.b.iterItems(opt_fields, function(name, value) { |
| 90 e[name] = value; |
| 91 }); |
| 92 } |
85 return target.dispatchEvent(e); | 93 return target.dispatchEvent(e); |
86 } | 94 } |
87 | 95 |
88 return { | 96 return { |
89 Event: Event, | 97 Event: Event, |
90 dispatchSimpleEvent: dispatchSimpleEvent | 98 dispatchSimpleEvent: dispatchSimpleEvent |
91 }; | 99 }; |
92 }); | 100 }); |
93 </script> | 101 </script> |
OLD | NEW |