(dispatch)
| 410 | } |
| 411 | }; |
| 412 | function d3_dispatch_event(dispatch) { |
| 413 | var listeners = [], listenerByName = new d3_Map(); |
| 414 | function event() { |
| 415 | var z = listeners, i = -1, n = z.length, l; |
| 416 | while (++i < n) if (l = z[i].on) l.apply(this, arguments); |
| 417 | return dispatch; |
| 418 | } |
| 419 | event.on = function(name, listener) { |
| 420 | var l = listenerByName.get(name), i; |
| 421 | if (arguments.length < 2) return l && l.on; |
| 422 | if (l) { |
| 423 | l.on = null; |
| 424 | listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); |
| 425 | listenerByName.remove(name); |
| 426 | } |
| 427 | if (listener) listeners.push(listenerByName.set(name, { |
| 428 | on: listener |
| 429 | })); |
| 430 | return dispatch; |
| 431 | }; |
| 432 | return event; |
| 433 | } |
| 434 | d3.event = null; |
| 435 | function d3_eventPreventDefault() { |
| 436 | d3.event.preventDefault(); |
no outgoing calls
no test coverage detected