Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rdh resource fetcher plugin #149

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

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 join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants