Ion-searchbar pure javascript ion events


I’m using ionic 5 in a pure javascript environment, well actually ‘preact’, and am trying to trigger on the ionChange event. This does not work, neither does the standard onchange / change event for this component.

I do not want to use the oninput (which does fire) as it triggers for every keystroke but ignores the debounce setting…

How can I trigger on the ionChange / onchange / change event ???

With ion-button etc I have to use the click / onclick rather than the ionClick event which does not fire.

Any help here would be appreciated

Ok. so I fixed it.

I used ‘useEffect’ in the functional component and set the second parameter to so it only runs once after the first render and added event listeners for ionClear and ionChange there.

As the component is dynamic i.e. it only gets rendered on certain conditions this seems the only place I can actually add the event listeners.

However, for javascript only solutions it would be good if the <ion-searchbar …/> would accept ionChange=’’ and ionClear=’’ the same way native event listeners can be added such as adding input=’’ directly in the markup