as shown in the below posted code, i want to execute some side effects in evtListener when a feature is removed from the vector-source.
at run time, when deleteSelectedGeometry function is invoked, the geometry gets deleted, but the event-listener evtListener posted below in the code is never invoked, hence, the
side effect code in it can not be executed.
to solve this issue, i registered for the event clear of the vector source, when i do clear the vector source, the listener registered to liste to the event clear gets executed.
please let me know why the event-listener registerd to listen to removeFeature is not getting executed
code
deleteSelectedGeometry() {
if (this.#featureRecentlyHovered != null) {
this.#vectorSource.removeFeature(this.#featureRecentlyHovered);
}
}
#evtListener = (evt) => {
if (this.#featureRecentlyHovered != null) {
this.#initWatcherOnDeleteGeometry.value = useWatchedVarUpdat();
}
}
registerOnRemoveFeatureFromVectorSource() {
this.#keyOnRemoveFeature = this.#vectorSource.once('removefeature', (evt) => this.#evtListener(evt));
}