Skip to content

Add `destroy()` method

Compare
Choose a tag to compare
@wa0x6e wa0x6e released this 29 Oct 02:45
· 1004 commits to master since this release

destroy() will remove the calendar from the DOM.

It can also takes a function as argument, that will be executed when the calendar is removed, at the end of the animation.

destroy() always returns null, so remember to assign it to your calendar instance, to also free the memory.

var cal = new CalHeatMap();
cal.init({}); // Creating the calendar
cal = cal.destroy(); // Remove the calendar from the DOM, and assign the 'cal' variable to `null`, avoiding memory leak