MCPcopy
hub / github.com/jipegit/OSXAuditor / d3_dispatch_event

Function d3_dispatch_event

d3-3.2.8/d3.js:412–433  ·  view source on GitHub ↗
(dispatch)

Source from the content-addressed store, hash-verified

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();

Callers 2

d3.jsFile · 0.85
d3_eventDispatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected