-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
Currently, there's no way to control whether existing listeners should be preserved or removed when using mutationReady on an element multiple times. This can lead to duplicate callbacks.
Describe the solution you'd like
Add an options parameter with removeExisting flag:
mutationReady('.my-element', callback, { removeExisting: true });This would:
- Remove existing listeners when removeExisting is true
- Keep current behaviour (multiple listeners) when false or undefined
Example Usage
// Clear existing and add new
mutationReady('.element', callback, { removeExisting: true });
// Current behaviour
mutationReady('.element', callback);Additional context
Useful for SPAs where components might be mounted multiple times.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request