django-elm
django-elm copied to clipboard
Add handlers for destroy and update
Not sure how useful these will be but it would be handy to provide handlers for the update and destroy lifecycles that defo provides.
return {
// Called whenever the value of the `djelm` attribute changes
update: (newData, oldData) => {},
// Called when the element (or its djelm attribute) is removed from the DOM
destroy: () => {},
};
The destroy lifecycle would be called when the elm runtime takes over the element that's used for the program because that is the program defo is listening for to load the program.
The update function is called when the data changes, however once the Elm runtime takes over the element it wouldn't be updating anymore.