Skip to content

Conversation

@Protected
Copy link
Contributor

It's useful to have a consistent way to identify the book loader associated with the foliate-view, so the external application (the reader, let's call it) can behave differently in response to it.

Some examples:

  • I don't want to display a TOC for comic books, but I want to display a TOC for other fixed-layout books.
  • I would want PDFs to scroll, so they can be taller than the viewports, but I wouldn't want comic-books to scroll, even though both are fixed-layout.
    etc.

@johnfactotum
Copy link
Owner

I guess it could be convenient in some cases, though I'd prefer if it's a property on the view object. Or rather, whatever it is that actually calls these book object functions; because the type of the file is determined before it is passed to these functions, so they have really very little to do with it.

Also, is there any particular reason why you'd use Object.defineProperty here?

@Protected
Copy link
Contributor Author

It's just the equivalent of the read only getter on classes. No serious reason.

@Protected
Copy link
Contributor Author

Like this, then?

@johnfactotum
Copy link
Owner

I meant on the View class itself. There's already a somewhat awkward isFixedLayout property, which is similar. But even that feels kind of wrong, to be honest.

One idea is to turn it into two functions. One for detecting the type, and the other for actually creating the book, given the type.

Ultimately, I guess it's not entirely clear what "type" means. If it can be more or less equated with media types, then you likely already have that from the file object or filesystem itself before opening the book. And if a better check than the system-provided media type is needed, then the above idea of separating out a function for detecting the type could work. But in the end, this is just a broad format, not really saying anything about the actual content of the book. For example, a fixed-layout EPUB could be a comic book, and a CBZ could be scans of a non-comic book, and so on.

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