Skip to content

Instantly share code, notes, and snippets.

@maplpro
Created September 21, 2010 18:00
Show Gist options
  • Save maplpro/590139 to your computer and use it in GitHub Desktop.
Save maplpro/590139 to your computer and use it in GitHub Desktop.
goog.net.BulkLoader
var bulkLoader = new goog.net.BulkLoader(urls);
goog.events.listen(bulkLoader,
[goog.net.EventType.SUCCESS, goog.net.EventType.ERROR],
function(e) {
if (e.type == goog.net.EventType.SUCCESS) {
// We use unsafeParse here because we trust the source of the data.
var loader = /** @type {goog.net.BulkLoader} */ (e.target);
var json = goog.array.map(loader.getResponseTexts(),
goog.json.unsafeParse),
showEventsOnCalendar(json);
} else {
// Here, e.type is goog.net.EventType.ERROR
alert('Oh no - I should add some error handling here!');
}
bulkLoader.dispose();
});
bulkLoader.load()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment