Closed Dedrakot closed 7 years ago
I am making some content caching. So I just don`t want to cache not complete pages. I don't know the best way to do it because I am not familiar with the code base. But for the moment I added ContentObserver and pass it through BoxFactory (commit in my forked repo). It will be grate if similar functionality will be added in future.
I like the concept of ContentObserver
. However, I have implemented a slightly different way of registering the observer to be consistent with the rest of the API. See this commit.
The observer is configured via the BrowserCanvas
config, e.g.:
canvas.getConfig().setContentObserver(x);
similarly to the other configuration options.
I was not sure about your changes in ContentImage; I have just proposed a solution with minimal necessary changes. If this does not fit your use case, feel free to adapt the code and submit a pull request. Just please include only the necessary changes in the PR, no code reformatting and unrelated improvements. Thanks!
Once this is completed, I may create a new project release.
Thanks and sorry for late answer. My changes in ContentImage not important and possibly not precisely correct and put observer through config is definitely better.
If image not loaded it will be usefull to know that result is not complete. Now in a ContentImage we just log error and possibly call ImageCache.putFailed(url).