Created
September 21, 2010 18:00
-
-
Save maplpro/590139 to your computer and use it in GitHub Desktop.
goog.net.BulkLoader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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