You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If elements is an empty array (which evaluates to true in javascript), the update() function is called. If elements is false (i.e. developer chooses to ignore the current documentation and passes false as parameter to the fetch callback), update() is not called.
This is actually quite nice as it gives the developer a choice of what to do in the situation where e.g. they are using ajax to power the autocomplete suggestions and a user types the beginning of a place name, ajax returns with some results and user keeps on typing. In this case, if another ajax request is fired but this time no results come back, the developer can decide whether to pass an empty array in the fetch calback (thus closing the suggestions) or pass false (which would keep the suggestions open from the first ajax result).
I am using the above technique at the moment and it is actually quite useful. Maybe the documentation for fetch should mention this possibility so others can benefit?
The text was updated successfully, but these errors were encountered:
Hi.
Because of this line in the
keyup
function:If
elements
is an empty array (which evaluates to true in javascript), theupdate()
function is called. Ifelements
is false (i.e. developer chooses to ignore the current documentation and passes false as parameter to the fetch callback),update()
is not called.This is actually quite nice as it gives the developer a choice of what to do in the situation where e.g. they are using ajax to power the autocomplete suggestions and a user types the beginning of a place name, ajax returns with some results and user keeps on typing. In this case, if another ajax request is fired but this time no results come back, the developer can decide whether to pass an empty array in the fetch calback (thus closing the suggestions) or pass
false
(which would keep the suggestions open from the first ajax result).I am using the above technique at the moment and it is actually quite useful. Maybe the documentation for
fetch
should mention this possibility so others can benefit?The text was updated successfully, but these errors were encountered: