Make reuse of the Readium object mandatory and document it
If the Readium object were reused for opening books, we would be able to install cleanup logic on the openPackageDocument() method, as an initial step before opening a new EPUB document. Such logic is needed for properly disposing of (revoking) of any object URLs and their related Blob objects.
Note that reuse of the Readium object would need to be made obligatory and documented in the ReadiumJS API documentation.
See also readium/readium-js-viewer#138.
After closer consideration, I think that the cleanup should be based on a mandatory invocation of a Readium.closePackageDocument() method, in analogy to the current Readium.closePackageDocument() method. That's the approach I've adopted with the fix I'm currently working on.
The Readium object reuse issue still stands, though. The argument is that our current Readium API indirectly implies that the Readium object is designed for reuse - its constructor does not accept any arguments related to opening a specific EPUB, just some general options.
The EPUB document specific arguments are only passed to the Readium.openPackageDocument() method, which can be called multiple times on the given Readium object.
This API design implies that the object can be subsequently reused for multiple EPUBs, provided that the el reader container element, passed to the Readium constructor in readerOptions, remains unchanged (unfortunately, readium-js-viewer currently goes against this by destroying the contents of the #app-container element each time the user navigates to the viewer's library).
The lifecycle of the "reader" object is indeed a tricky subject, especially as readium-js-viewer has its own cleanup logic to de-register event listeners. We definitely need to revisit this topic, but I suggest to downgrade from priority:High to a lower one. Perhaps the "reader" API will be cleaned-up and optimized in a more significant, long-term refactoring of the code base / architecture?