use of im.actor.runtime.js.fs.JsBlob in project actor-platform by actorapp.
the class JsSmallAvatarFileCache method onAvatarUrlLoaded.
private void onAvatarUrlLoaded(final long id, String url) {
JsHttpRequest request = JsHttpRequest.create();
request.open("GET", url);
request.setOnLoadHandler(new JsHttpRequestHandler() {
@Override
public void onStateChanged(JsHttpRequest request) {
if (request.getReadyState() == 4) {
if (request.getStatus() == 200) {
JsBlob blob = request.getResponseBlob();
onAvatarDownloaded(id, blob);
} else {
// TODO: Implement better
cachedImages.put(id, null);
}
}
}
});
request.send();
}
Aggregations