* Loads requested API libraries and calls an handler after finished.
*
* @param callback the handler to be called
*/
public void loadApi(Runnable callback) {
AjaxLoaderOptions options = AjaxLoaderOptions.newInstance();
JsArrayString packagesArray = JsArrayString.createArray().cast();
for (int i = 0; i < packages.length; i++) {
packagesArray.push(packages[i].getName());
}
options.setPackages(packagesArray);
if (language != null) {
options.setLanguage(language);
}
AjaxLoader.loadApi(API_NAME, version, callback, options);
}