MCPcopy Create free account
hub / github.com/breck7/scroll / onAdd

Function onAdd

external/.d3.js:2422–2438  ·  view source on GitHub ↗
(typename, value, options)

Source from the content-addressed store, hash-verified

2420}
2421
2422function onAdd(typename, value, options) {
2423 return function() {
2424 var on = this.__on, o, listener = contextListener(value);
2425 if (on) for (var j = 0, m = on.length; j < m; ++j) {
2426 if ((o = on[j]).type === typename.type && o.name === typename.name) {
2427 this.removeEventListener(o.type, o.listener, o.options);
2428 this.addEventListener(o.type, o.listener = listener, o.options = options);
2429 o.value = value;
2430 return;
2431 }
2432 }
2433 this.addEventListener(typename.type, listener, options);
2434 o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};
2435 if (!on) this.__on = [o];
2436 else on.push(o);
2437 };
2438}
2439
2440function selection_on(typename, value, options) {
2441 var typenames = parseTypenames(typename + ""), i, n = typenames.length, t;

Callers

nothing calls this directly

Calls 1

contextListenerFunction · 0.85

Tested by

no test coverage detected