I have an app that currently fires correctly on place_changed.
However, I want to branch search to behave differently when a user has selected an autocomplete entry,
If you add your own input handler (for example catching CR after user entering his own text), autocomplete and your function may call your method back to back. My solution is to use throttle to avoid the repeated call:
$('#sell_address_input').keyup(function(e){ if(e.keyCode==13){throttle(addressEntered(),1000)}});
....
function throttle(callback, limit) {
var wait = false; // Initially, we're not waiting
return function () { // We return a throttled function
if (!wait)
{ // If we're not waiting
callback.call(); // Execute users function
wait = true; // Prevent future invocations
setTimeout(function ()
{ // After a period of time
wait = false; // And allow future invocations
}, limit);
}
}
}