Well if you already know the concept of JSNI then you can use it to add a
listener to GWT's XMLHttpRequest as its an ordinary JavaScriptObject. You
either extend it or create a utility method. Something along these lines
(probably not fully correct):
public native void setProgressListener(MyProgressListener p) /*-{
this.upload.addEventListener("progress", function(event) {
[email protected]::onProgress(II)(event.loaded,
event.total);
}, false);
}-*/;
A utility method would have an additional XMLHttpRequest parameter and use
request.upload instead of this.upload.
Don't forget to cleanup the event listener after you are done. Also note
that XMLHttpRequest.create() can return an IE specific object which might
not support the progress feature or which requires you do register the
listener differently. So your implementation might be a bit more
complicated depending on your browser support requirements.
-- J.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.