dispatch method
Selection
dispatch(
- String type, [
- Union2<
EachCallback< ? parametersDispatchParams?> , DispatchParams?>
Dispatches a custom event of the specified type to each selected element, in order.
d4.select("p".u21).dispatch("click");
An optional parameters object may be specified to set additional properties of the event. It may contain the following fields:
bubbles
- if true, the event is dispatched to ancestors in reverse tree order.cancelable
- if true, event.preventDefault is allowed.detail
- any custom data associated with the event.
If parameters is a function, it is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with thisArg as the current DOM element (nodes[i]). It must return the parameters for the current element.
Implementation
Selection dispatch(String type,
[Union2<EachCallback<DispatchParams?>, DispatchParams>? parameters]) {
return each(
parameters?.split(
(callback) => dispatchFunction(type, callback),
(params) => dispatchConstant(type, params),
) ??
dispatchConstant(type, null),
);
}