(dispatch)
| 378 | } |
| 379 | }; |
| 380 | function d3_dispatch_event(dispatch) { |
| 381 | var listeners = [], listenerByName = new d3_Map(); |
| 382 | function event() { |
| 383 | var z = listeners, i = -1, n = z.length, l; |
| 384 | while (++i < n) if (l = z[i].on) l.apply(this, arguments); |
| 385 | return dispatch; |
| 386 | } |
| 387 | event.on = function(name, listener) { |
| 388 | var l = listenerByName.get(name), i; |
| 389 | if (arguments.length < 2) return l && l.on; |
| 390 | if (l) { |
| 391 | l.on = null; |
| 392 | listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); |
| 393 | listenerByName.remove(name); |
| 394 | } |
| 395 | if (listener) listeners.push(listenerByName.set(name, { |
| 396 | on: listener |
| 397 | })); |
| 398 | return dispatch; |
| 399 | }; |
| 400 | return event; |
| 401 | } |
| 402 | d3.event = null; |
| 403 | function d3_eventCancel() { |
| 404 | d3.event.stopPropagation(); |
no outgoing calls
no test coverage detected