Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.

Conversation

kimtuck
Copy link

@kimtuck kimtuck commented Nov 22, 2016

This pull request is Finalized

Related issue(s) and/or pull request(s)

See also #144*

Test cases, sample files

Additional information

This code allows for a resource fetcher plugin. If one is specified, then it is used in place of the built-in resource fetchers.

The Bibliotheca hybrid app uses this to load a resource fetcher that gets content from an API.

Some thoughts on this code:

  1. in publication_fetcher.js, about line 137, the code is slightly different between the base code and this code; specifically I removed isExploded(). I'm not sure if that is a breaking change for users that don't have a plugin.

  2. It would be nice to move the existing resource fetchers to plugins as well.

  3. I don't know how to clear up the "readium_shared_js" issue that I see at the bottom of this pull request.


var resourcePluginKey='ResourceFetcherPlugin';
var plugins = ReadiumSDK.Plugins.getLoadedPlugins()
if (_.has(plugins, resourcePluginKey)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way to test for whether or not a plugin is loaded, based on its registered name:
https://github.com/readium/readium-js/blob/develop/dev/index.js#L146

if (ReadiumSDK.reader.plugins.ResourceFetcherPlugin) {
...
}

(I'm not 100% sure that ReadiumSDK.reader is valid ... to be verified)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants