The onBeforeCellDomRemove handler runs before a day cell’s custom content is removed. Use it to release resources your application associated with that rendered occurrence.
Declaration
DayPilot.Month.onBeforeCellDomRemove(args)
Parameters
args.control(DayPilot.Month, read-only): the control instance.args.cell.startandargs.cell.end(DayPilot.Date, read-only): the day-cell range, with an exclusive end.args.element(read-only): the content originally supplied to onBeforeCellDomAdd, ornullif none was supplied.
JavaScript Cleanup
Associate cleanup with each created DOM element, for example to cancel an application subscription. The following removal handler uses cleanup functions registered by your DOM-add callback:
// The DOM-add callback stores an element's cleanup function in this WeakMap.
const cleanups = new WeakMap();
const month = new DayPilot.Month("month", {
onBeforeCellDomRemove: args => {
const element = args.element;
if (!element) return;
const cleanup = cleanups.get(element);
if (cleanup) {
cleanup();
cleanups.delete(element);
}
}
});
month.init();
Framework Cleanup
Angular
The wrapper disposes embedded templates and child components automatically. Release component-owned resources in Angular lifecycle cleanup. See Angular templates.
React
The wrapper unmounts custom React content. Use an effect's cleanup function for subscriptions owned by the child; do not manually unmount wrapper-owned roots. See React integration.
Vue
The wrapper unmounts slot content. Use Vue's component lifecycle cleanup for resources owned by a child. See Vue integration.
See Also
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot