Skip to content

Instantly share code, notes, and snippets.

@shouse
Last active August 29, 2015 14:06
Show Gist options
  • Save shouse/ce2a960c73e099aed024 to your computer and use it in GitHub Desktop.
Save shouse/ce2a960c73e099aed024 to your computer and use it in GitHub Desktop.
Ti.Map :: Event : Region Changed happens continuously when moving map. Here's a fix
var updateMapTimeout;
$.mapView.addEventListener('regionChanged', function() {
if (updateMapTimeout) clearTimeout(updateMapTimeout);
// Wait 100ms and if timeout hasn't been cleared by another regionChanged event then it's good to go
updateMapTimeout = setTimeout(function() {
// update your map
}, 100);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment