MCPcopy Index your code
hub / github.com/idank/explainshell / d3_dispatch_event

Function d3_dispatch_event

explainshell/web/static/js/d3.v3.js:380–401  ·  view source on GitHub ↗
(dispatch)

Source from the content-addressed store, hash-verified

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

Callers 2

d3.v3.jsFile · 0.85
d3_eventDispatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected