I have an auto-complete-like feature on a text box.
textBox.addKeyUpHandler(textBoxLookupHandler)
What happens
If the user is typing relatively quickly, say a b, it seems the following happens.
- The handler for
ais invoked. - The handler for
abis invoked. abreturns fewer results. Because of this, it returns before the handler fora.- The handler for
athen returns many results.
So in the end, the user typed ab, but they are being shown the results for a because the results for a overwrote the results for ab.
Possible solutions
If I could write some client-side scripting, I know how I would handle this issue. But since I'm using UiApp, I can't do that.
- Guarantee order of execution of GAS (I'm sure this isn't possible/is a ridiculous request)
- Have some method in GAS to cancel all other currently running scripts.