// make multiple IO requests and deal with them when they are all completed
Y.when(
Y.ioDeferred().get(GWT.getModuleBaseURL()+"testfiles/page1.html"),
Y.ioDeferred().get(GWT.getModuleBaseURL()+"testfiles/json1.json"),
Y.ioDeferred().getJSON(GWT.getModuleBaseURL()+"testfiles/json1.json") //do not work
).then(new Callback() {
@Override
public void call(JsArrayMixed args) {
JsArrayMixed a = args.getObject(0);
JsArrayMixed b = args.getObject(1);
// args is an array with 2 arrays a and b
// a and b are arrays with the arguments received by deferred.resolve() in each case,
// so the first element in each array is an EventFacade with responseText and data properties
IODeferredEvent resp1 = a.getObject(0).cast();
IODeferredEvent resp2 = b.getObject(0).cast();
console.log("resp1 : "+resp1.responseText()+" - resp2 : "+resp2.responseText());
}
}, new Callback() {
@Override
public void call(JsArrayMixed args) {
console.log("Some resources cannot be loaded.");
}
});