I'm having trouble with the following code snippet. My init method needs to run and complete the getLocation() function before the initializeMapp() and geoListen() can run. I have rsvp.js linked as a resource, but not quite sure how to implement. I also tried the jQuery $when.done method. Any help is appreciated.
jQuery Method:
//initial page load method
function init() {
//get user location then builds map and listens to database
$.when(getLocation()).done.(function () {
//build map now that you have user location
initializeMap();
//Starts listening to database changes
geoListen();
})
}
RSVP method:
//initial page load method
function init() {
//get user location then builds map and listens to database
getLocation().then(function () {
//build map now that you have user location
initializeMap();
//Starts listening to database changes
geoListen();
})
}