Skip to content

Conversation

@evanminto
Copy link
Contributor

Also adds some QUnit tests and updates documentation.

Jira: WEBDEV-1528

@evanminto evanminto requested a review from rchrd2 April 25, 2018 19:12
@rchrd2
Copy link
Member

rchrd2 commented Apr 25, 2018

In package.json there's a script for "node-qunit-phantomjs", but it's not included as a dep. Can you please add node-qunit-phantomjs to package.json or remove the script if it's not used.

Copy link
Member

@rchrd2 rchrd2 left a comment

Choose a reason for hiding this comment

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

I think we should put the jquery-1.10.1.js in the same BookReader dir. I think it's maybe the only 3rd party library that's not included, so may as well put with the others.

Copy link
Member

@rchrd2 rchrd2 left a comment

Choose a reason for hiding this comment

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

It kind of seems like the iframe communication should be it's own plugin.

I don't see it as being fundamentally part of the URL plugin, but more like an extra feature.

What do you think?

@evanminto
Copy link
Contributor Author

My thinking on the iframe communication being its own plugin: I considered it, but it’s kind of tied to the idea of the params path and the URL. I don't see a way that it could be decoupled from that, but maybe I'm missing something.

@evanminto
Copy link
Contributor Author

I should say, it's not IMPOSSIBLE to decouple it, but it would require a bigger rethink of the interface that plugins and other code use to interact with BookReader (i.e. more based on events and less on prototype modification).

@rchrd2
Copy link
Member

rchrd2 commented Apr 25, 2018

But what if it was a plugin that depends on the url plugin? In the comment it could say "depends on plugin.url.js".

@evanminto
Copy link
Contributor Author

I'm not comfortable with having plugin dependencies like that, at least not right now while the plugins are all tightly coupled to the internal workings of BookReader. You'd have one plugin which makes prototype modifications and relies on prototype modifications made by another plugin. Gets pretty gnarly if you ever want to, say, change the URL plugin.

@rchrd2
Copy link
Member

rchrd2 commented Apr 25, 2018 via email

Evan Minto added 2 commits April 30, 2018 17:00
@evanminto
Copy link
Contributor Author

This is ready for re-review, @rchrd2.

Copy link
Member

@rchrd2 rchrd2 left a comment

Choose a reason for hiding this comment

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

We reviewed in peson.

* parent window when pages change, and the parent window can also
* explicitly request a page change by sending its own message.
*
* @param {BookReader} bookReader
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: Throughout the bookreader codebase, an instance of BookReader is usually named br. Rename it to this to be consistent.

title += '...';
return title;
};
jQuery.extend(true, BookReader.defaultOptions, {
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: In all the other plugins, this function call and the setup method are at the top of the file. This makes it easy to see what the plugin options are.

Can you move this to the top of the file?

bookId: '',
// Defaults can be a urlFragment string
defaults: null,
});
Copy link
Member

Choose a reason for hiding this comment

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

The iframe communication should probably also have an option to disable. Like enableIframeCommunication: true

*/
function setUpIframeCommunication(bookReader) {
// Not embedded, abort
if (!window.parent) {
Copy link
Member

Choose a reason for hiding this comment

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

Note. There's a difference between "embedded" and in an iframe.

There's ui=embed.

You may want to change this comment to be more clear with that. Like Not in iframe, abort


/**
* Set up two-way communication between the BookReader and a parent window
* (if the reader is embedded via an iframe)
Copy link
Member

Choose a reason for hiding this comment

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

See my other note about "embed" vs "iframe" terminology.

@rchrd2 rchrd2 merged commit 3f5f495 into master May 2, 2018
@rchrd2 rchrd2 deleted the webdev-1528-book-preview-beta-api branch December 1, 2018 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants