The onBeforeEventDomRemove handler runs before an event’s custom content is removed. Use it to release resources your application associated with that rendered occurrence.

Declaration

DayPilot.Month.onBeforeEventDomRemove(args)

Parameters

  • args.control (DayPilot.Month, read-only): the control instance.
  • args.e (DayPilot.Event, read-only): the event associated with the removed occurrence.
  • args.element (read-only): the content originally supplied to onBeforeEventDomAdd, or null if 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", {
  onBeforeEventDomRemove: 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

onBeforeEventDomAdd

Month Events

Availability

Availability of this API item in DayPilot editions:

ProductLitePro
DayPilot for JavaScript