How does Amap poi search stop sending requests?

I wrote a poi search box according to the demo, on Amap"s api and called AMap.plugin (["AMap.Autocomplete"," AMap.PlaceSearch"], function () {}). When I was debugging, I found that when the input box was typing (rapidly increasing or decreasing input characters), the api would always send requests to the Gaud server (this situation is really impossible to take screenshots, I don"t know if you can understand what I mean).
and I guess this api is to request the server and call back the poi search results by listening for changes in the oninput event of input. And this leads to the situation I encountered: when I quickly add or subtract input characters, the following hotspot list will keep flashing, because when I delete or add a character, the request callback of the Gaud server has not yet been returned. I continue to delete or add characters, and the previous callback has just returned.
because there is no api, that accepts callbacks in the manual You can only call and listen for list click events (Gaud"s api). My idea is that when I am deleting or adding quickly, I delay listening for character changes to reduce the number of requests, but do not end the api of the request. Does anyone know how to solve this need?

Mar.01,2021

I'll do it myself, big gods, give me a hand.
it doesn't work well with xhr's abort () estimate. The background request interface of its api is encapsulated in the amap object, and I can't even find out which request interface it corresponds to.
did you encounter this hole when adjusting the map interface? Do you have a solution to your labor? share it with your younger brother

.
Menu