natural-gallery-js
natural-gallery-js copied to clipboard
gallery.removeEventListener
There should probably be a removeEventListener
function. Currently I have a listener that I only want to fire the first time the event happens (after the first image has loaded). It would be nice to be able to clean up after myself.
Instead of removeEventListener
, I'd recommend exposing the underlying options as seen below. That gives the possibility to use once
, or signal
which is the superior way to remove an event listener nowadays.
- public addEventListener(name: [...], callback: [...]): void {
- this.elementRef.addEventListener(name, callback);
+ public addEventListener(name: [...], callback: [...], options?: AddEventListenerOptions): void {
+ this.elementRef.addEventListener(name, callback, options);
@PowerKiKi even better! Thanks, I didn't know you could do all those things with options.
Done in cb4149a5bd73605f1be547c4d494f69798e79fa6