In Java the class loader dynamically loads Java classes into the JVM. In Javascript , I often have a problem with a call being made with an unloaded dependency, because loading is asynchronous.
I am using Angular JS framework. For example, one page is API dependent, but receives the Cannot read property 'realestate' of undefined error message when called
gapi.client.realestate.get(propertyId).execute(function(resp) { console.log(resp); });
because the API is not loaded. Download using
loadRealEstateAPI = function() { var ROOT = 'http://localhost:8888/_ah/api'; gapi.client.load('realestate', 'v1', function() { console.log("Real Estate API loaded"); $rootScope.$broadcast("reAPILoaded", true); }, ROOT); }
I would like to know if there is a JS library that allows an application to start when all dependencies are loaded.
source share