mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
Allow book to be called with just options
This commit is contained in:
parent
ff68ab3f35
commit
f4ef0acf40
5 changed files with 2780 additions and 124 deletions
File diff suppressed because it is too large
Load diff
|
@ -8,7 +8,6 @@ Creates a new Book
|
||||||
|
|
||||||
- `url` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer))** URL, Path or ArrayBuffer
|
- `url` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer))** URL, Path or ArrayBuffer
|
||||||
- `options` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** to pass to the book
|
- `options` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** to pass to the book
|
||||||
- `options.request` the request function to use
|
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
|
@ -18,15 +17,31 @@ ePub("/path/to/book.epub", {})
|
||||||
|
|
||||||
Returns **[Book](#book)** a new Book object
|
Returns **[Book](#book)** a new Book object
|
||||||
|
|
||||||
|
## register
|
||||||
|
|
||||||
|
register plugins
|
||||||
|
|
||||||
|
### manager
|
||||||
|
|
||||||
|
register a new view manager
|
||||||
|
|
||||||
|
### view
|
||||||
|
|
||||||
|
register a new view
|
||||||
|
|
||||||
# Book
|
# Book
|
||||||
|
|
||||||
Creates a new Book
|
Creates a new Book
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `_url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
- `url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
- `options` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
- `options` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
||||||
- `options.requestMethod` **method** a request function to use instead of the default
|
- `options.requestMethod` **method** a request function to use instead of the default
|
||||||
|
- `options.requestCredentials` **\[[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** send the xhr request withCredentials (optional, default `undefined`)
|
||||||
|
- `options.requestHeaders` **\[[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** send the xhr request headers (optional, default `undefined`)
|
||||||
|
- `options.encoding` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** optional to pass 'binary' or base64' for archived Epubs (optional, default `binary`)
|
||||||
|
- `options.replacements` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** use base64, blobs, or none for replacing assets in archived Epubs (optional, default `base64`)
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
|
@ -36,38 +51,73 @@ new Book("/path/to/book.epub", {})
|
||||||
|
|
||||||
Returns **[Book](#book)**
|
Returns **[Book](#book)**
|
||||||
|
|
||||||
## url
|
## opened
|
||||||
|
|
||||||
## loaded
|
|
||||||
|
|
||||||
**Properties**
|
**Properties**
|
||||||
|
|
||||||
- `loaded.manifest` **[promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A child method as property defination
|
- `opened` **[promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** returns after the book is loaded
|
||||||
|
|
||||||
|
## spine
|
||||||
|
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
- `spine` **[Spine](#spine)**
|
||||||
|
|
||||||
|
## locations
|
||||||
|
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
- `locations` **[Locations](#locations)**
|
||||||
|
|
||||||
|
## navigation
|
||||||
|
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
- `navigation` **[Navigation](#navigation)**
|
||||||
|
|
||||||
|
## pageList
|
||||||
|
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
- `pagelist` **[PageList](#pagelist)**
|
||||||
|
|
||||||
## open
|
## open
|
||||||
|
|
||||||
open a url
|
Open a epub or url
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `_url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** URL, Path or ArrayBuffer
|
- `input` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** URL, Path or ArrayBuffer
|
||||||
- `options` **\[[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** to force opening
|
- `what` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** to force opening
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
book.open("/path/to/book.epub", { base64: false })
|
book.open("/path/to/book.epub")
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** of when the book has been loaded
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** of when the book has been loaded
|
||||||
|
|
||||||
## unpack
|
## load
|
||||||
|
|
||||||
unpack the contents of the Books packageXml
|
Load a resource from the Book
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `packageXml` **[document](https://developer.mozilla.org/en-US/docs/Web/JavaScript)** XML Document
|
- `path` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** path to the resource to load
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** returns a promise with the requested resource
|
||||||
|
|
||||||
|
## resolve
|
||||||
|
|
||||||
|
Resolve a path to it's absolute position in the Book
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `path` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
- `absolute` **\[[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** force resolving the full URL
|
||||||
|
|
||||||
|
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the resolved path string
|
||||||
|
|
||||||
## section
|
## section
|
||||||
|
|
||||||
|
@ -83,45 +133,479 @@ Sugar to render a book
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `element`
|
- `element` **[element](https://developer.mozilla.org/en-US/docs/Web/API/Element)** element to add the views to
|
||||||
- `options`
|
- `options` **\[[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]**
|
||||||
|
|
||||||
## requestMethod
|
Returns **[Rendition](#rendition)**
|
||||||
|
|
||||||
Switch request methods depending on if book is archived or not
|
## setRequestCredentials
|
||||||
|
|
||||||
|
Set if request should use withCredentials
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `_url`
|
- `credentials` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
|
||||||
|
|
||||||
## unarchive
|
## setRequestHeaders
|
||||||
|
|
||||||
Unarchive a zipped epub
|
Set headers request should use
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `bookUrl`
|
- `headers` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
||||||
- `isBase64`
|
|
||||||
|
|
||||||
## isArchivedUrl
|
|
||||||
|
|
||||||
Checks if url has a .epub or .zip extension, or is ArrayBuffer (of zip/epub)
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
- `bookUrl`
|
|
||||||
|
|
||||||
## coverUrl
|
## coverUrl
|
||||||
|
|
||||||
Get the cover url
|
Get the cover url
|
||||||
|
|
||||||
|
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** coverUrl
|
||||||
|
|
||||||
## range
|
## range
|
||||||
|
|
||||||
Find a DOM Range for a given CFI Range
|
Find a DOM Range for a given CFI Range
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `cfiRange`
|
- `cfiRange` **[EpubCFI](#epubcfi)** a epub cfi range
|
||||||
|
|
||||||
|
Returns **[Range](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input)**
|
||||||
|
|
||||||
|
# Url
|
||||||
|
|
||||||
|
creates a uri object
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `urlString` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** a url string (relative or absolute)
|
||||||
|
- `baseString` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** optional base for the url,
|
||||||
|
default to window.location.href
|
||||||
|
|
||||||
|
Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** url
|
||||||
|
|
||||||
|
# Spine
|
||||||
|
|
||||||
|
A collection of Spine Items
|
||||||
|
|
||||||
|
## unpack
|
||||||
|
|
||||||
|
Unpack items from a opf into spine items
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `_package` **Package**
|
||||||
|
- `resolver` **method** URL resolver
|
||||||
|
|
||||||
|
## get
|
||||||
|
|
||||||
|
Get an item from the spine
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `target`
|
||||||
|
|
||||||
|
**Examples**
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
spine.get();
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
spine.get(1);
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
spine.get("chap1.html");
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
spine.get("#id1234");
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns **[Section](#section)** section
|
||||||
|
|
||||||
|
## each
|
||||||
|
|
||||||
|
Loop over the Sections in the Spine
|
||||||
|
|
||||||
|
Returns **method** forEach
|
||||||
|
|
||||||
|
# Section
|
||||||
|
|
||||||
|
Represents a Section of the Book
|
||||||
|
In most books this is equivelent to a Chapter
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `item` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** The spine item representing the section
|
||||||
|
- `hooks` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** hooks for serialize and content
|
||||||
|
|
||||||
|
## load
|
||||||
|
|
||||||
|
Load the section from its url
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `_request` **method** a request method to use for loading
|
||||||
|
|
||||||
|
Returns **[document](https://developer.mozilla.org/en-US/docs/Web/JavaScript)** a promise with the xml document
|
||||||
|
|
||||||
|
## render
|
||||||
|
|
||||||
|
Render the contents of a section
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `_request` **method** a request method to use for loading
|
||||||
|
|
||||||
|
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** output a serialized XML Document
|
||||||
|
|
||||||
|
## find
|
||||||
|
|
||||||
|
Find a string in a section
|
||||||
|
TODO: need reimplementation from v0.2
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `query` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** [description]
|
||||||
|
|
||||||
|
Returns **\[type]** [description]
|
||||||
|
|
||||||
|
## reconcileLayoutSettings
|
||||||
|
|
||||||
|
Reconciles the current chapters layout properies with
|
||||||
|
the global layout properities.
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `global` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** The globa layout settings object, chapter properties string
|
||||||
|
|
||||||
|
Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** layoutProperties Object with layout properties
|
||||||
|
|
||||||
|
## cfiFromRange
|
||||||
|
|
||||||
|
Get a CFI from a Range in the Section
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `_range` **[range](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input)**
|
||||||
|
|
||||||
|
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** cfi an EpubCFI string
|
||||||
|
|
||||||
|
## cfiFromElement
|
||||||
|
|
||||||
|
Get a CFI from an Element in the Section
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `el` **[element](https://developer.mozilla.org/en-US/docs/Web/API/Element)**
|
||||||
|
|
||||||
|
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** cfi an EpubCFI string
|
||||||
|
|
||||||
|
# Locations
|
||||||
|
|
||||||
|
Find Locations for a Book
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `spine` **[Spine](#spine)**
|
||||||
|
- `request` **[request](https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/request)**
|
||||||
|
|
||||||
|
## generate
|
||||||
|
|
||||||
|
Load all of sections in the book to generate locations
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `chars` **int** how many chars to split on
|
||||||
|
|
||||||
|
Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** locations
|
||||||
|
|
||||||
|
# Container
|
||||||
|
|
||||||
|
Handles Parsing and Accessing an Epub Container
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `containerDocument` **\[[document](https://developer.mozilla.org/en-US/docs/Web/JavaScript)]** xml document
|
||||||
|
|
||||||
|
## parse
|
||||||
|
|
||||||
|
Parse the Container XML
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `containerDocument` **[document](https://developer.mozilla.org/en-US/docs/Web/JavaScript)**
|
||||||
|
|
||||||
|
# Packaging
|
||||||
|
|
||||||
|
Open Packaging Format Parser
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `packageDocument` **[document](https://developer.mozilla.org/en-US/docs/Web/JavaScript)** OPF XML
|
||||||
|
|
||||||
|
## parse
|
||||||
|
|
||||||
|
Parse OPF XML
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `packageDocument` **[document](https://developer.mozilla.org/en-US/docs/Web/JavaScript)** OPF XML
|
||||||
|
|
||||||
|
Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** parsed package parts
|
||||||
|
|
||||||
|
## parseSpine
|
||||||
|
|
||||||
|
Parse Spine
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `spineXml` **[document](https://developer.mozilla.org/en-US/docs/Web/JavaScript)**
|
||||||
|
- `manifest` **Packaging.manifest**
|
||||||
|
|
||||||
|
Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** spine
|
||||||
|
|
||||||
|
## findCoverPath
|
||||||
|
|
||||||
|
Find the Cover Path
|
||||||
|
<item properties="cover-image" id="ci" href="cover.svg" media-type="image/svg+xml" />
|
||||||
|
Fallback for Epub 2.0
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `packageXml` **[document](https://developer.mozilla.org/en-US/docs/Web/JavaScript)**
|
||||||
|
|
||||||
|
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** href
|
||||||
|
|
||||||
|
# Navigation
|
||||||
|
|
||||||
|
Navigation Parser
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `xml` **[document](https://developer.mozilla.org/en-US/docs/Web/JavaScript)** navigation html / xhtml / ncx
|
||||||
|
|
||||||
|
## parse
|
||||||
|
|
||||||
|
Parse out the navigation items
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `xml` **[document](https://developer.mozilla.org/en-US/docs/Web/JavaScript)** navigation html / xhtml / ncx
|
||||||
|
|
||||||
|
## get
|
||||||
|
|
||||||
|
Get an item from the navigation
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `target` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
|
||||||
|
Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** navItems
|
||||||
|
|
||||||
|
# Resources
|
||||||
|
|
||||||
|
Handle Package Resources
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `manifest` **Manifest**
|
||||||
|
- `options` **\[[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]**
|
||||||
|
- `options.archive` **\[[Archive](#archive)]**
|
||||||
|
- `options.resolver` **\[method]**
|
||||||
|
|
||||||
|
## replacements
|
||||||
|
|
||||||
|
Create blob urls for all the assets
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `archive` **[Archive](#archive)**
|
||||||
|
- `resolver` **resolver** Url resolver
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** returns replacement urls
|
||||||
|
|
||||||
|
## relativeTo
|
||||||
|
|
||||||
|
Resolve all resources URLs relative to an absolute URL
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `absolute` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** to be resolved to
|
||||||
|
- `resolver` **\[resolver]**
|
||||||
|
|
||||||
|
Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>** array with relative Urls
|
||||||
|
|
||||||
|
## get
|
||||||
|
|
||||||
|
Get a URL for a resource
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `path` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
|
||||||
|
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** url
|
||||||
|
|
||||||
|
# PageList
|
||||||
|
|
||||||
|
Page List Parser
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `xml` **\[[document](https://developer.mozilla.org/en-US/docs/Web/JavaScript)]**
|
||||||
|
|
||||||
|
## parse
|
||||||
|
|
||||||
|
Parse PageList Xml
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `xml` **[document](https://developer.mozilla.org/en-US/docs/Web/JavaScript)**
|
||||||
|
|
||||||
|
## addCFIs
|
||||||
|
|
||||||
|
Replace HREFs with CFI
|
||||||
|
TODO: implement getting CFI from Href
|
||||||
|
|
||||||
|
## pageFromCfi
|
||||||
|
|
||||||
|
Get a PageList result from a EpubCFI
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `cfi` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** EpubCFI String
|
||||||
|
|
||||||
|
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** page
|
||||||
|
|
||||||
|
## cfiFromPage
|
||||||
|
|
||||||
|
Get an EpubCFI from a Page List Item
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `pg` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
|
||||||
|
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** cfi
|
||||||
|
|
||||||
|
## pageFromPercentage
|
||||||
|
|
||||||
|
Get a Page from Book percentage
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `percent` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)**
|
||||||
|
|
||||||
|
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** page
|
||||||
|
|
||||||
|
## percentageFromPage
|
||||||
|
|
||||||
|
Returns a value between 0 - 1 corresponding to the location of a page
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `pg` **int** the page
|
||||||
|
|
||||||
|
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** percentage
|
||||||
|
|
||||||
|
## percentageFromCfi
|
||||||
|
|
||||||
|
Returns a value between 0 - 1 corresponding to the location of a cfi
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `cfi` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** EpubCFI String
|
||||||
|
|
||||||
|
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** percentage
|
||||||
|
|
||||||
|
# Archive
|
||||||
|
|
||||||
|
Handles Unzipping a requesting files from an Epub Archive
|
||||||
|
|
||||||
|
## open
|
||||||
|
|
||||||
|
Open an archive
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `input` **binary**
|
||||||
|
- `isBase64` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** tells JSZip if the input data is base64 encoded
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** zipfile
|
||||||
|
|
||||||
|
## openUrl
|
||||||
|
|
||||||
|
Load and Open an archive
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `zipUrl` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
- `isBase64` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** tells JSZip if the input data is base64 encoded
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** zipfile
|
||||||
|
|
||||||
|
## request
|
||||||
|
|
||||||
|
Request
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** a url to request from the archive
|
||||||
|
- `type` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** specify the type of the returned result
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
|
||||||
|
|
||||||
|
## getBlob
|
||||||
|
|
||||||
|
Get a Blob from Archive by Url
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
- `mimeType` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]**
|
||||||
|
|
||||||
|
Returns **[Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob)**
|
||||||
|
|
||||||
|
## getText
|
||||||
|
|
||||||
|
Get Text from Archive by Url
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
- `encoding` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]**
|
||||||
|
|
||||||
|
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
|
||||||
|
## getBase64
|
||||||
|
|
||||||
|
Get a base64 encoded result from Archive by Url
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
- `mimeType` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]**
|
||||||
|
|
||||||
|
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** base64 encoded
|
||||||
|
|
||||||
|
## createUrl
|
||||||
|
|
||||||
|
Create a Url from an unarchived item
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
- `options`
|
||||||
|
- `options.base64` **\[[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** use base64 encoding or blob url
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** url promise with Url string
|
||||||
|
|
||||||
|
## revokeUrl
|
||||||
|
|
||||||
|
Revoke Temp Url for a achive item
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** url of the item in the archive
|
||||||
|
|
||||||
# EpubCFI
|
# EpubCFI
|
||||||
|
|
||||||
|
@ -144,3 +628,307 @@ Does Not Implement:
|
||||||
- `cfiFrom`
|
- `cfiFrom`
|
||||||
- `base`
|
- `base`
|
||||||
- `ignoreClass`
|
- `ignoreClass`
|
||||||
|
|
||||||
|
# content
|
||||||
|
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
- `hooks.content` **method**
|
||||||
|
|
||||||
|
# Rendition
|
||||||
|
|
||||||
|
[Rendition description]
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `book` **[Book](#book)**
|
||||||
|
- `options` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
||||||
|
- `options.width` **int**
|
||||||
|
- `options.height` **int**
|
||||||
|
- `options.ignoreClass` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
- `options.manager` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
- `options.view` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
- `options.layout` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
- `options.spread` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
- `options.minSpreadWidth` **int** overridden by spread: none (never) / both (always)
|
||||||
|
|
||||||
|
## hooks
|
||||||
|
|
||||||
|
Adds Hook methods to the Rendition prototype
|
||||||
|
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
- `hooks` **[Hook](#hook)**
|
||||||
|
|
||||||
|
## setManager
|
||||||
|
|
||||||
|
Set the manager function
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `manager` **[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
||||||
|
|
||||||
|
## requireManager
|
||||||
|
|
||||||
|
Require the manager from passed string, or as a function
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `manager` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function))** [description]
|
||||||
|
|
||||||
|
Returns **method**
|
||||||
|
|
||||||
|
## requireView
|
||||||
|
|
||||||
|
Require the view from passed string, or as a function
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `view` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function))**
|
||||||
|
|
||||||
|
Returns **view**
|
||||||
|
|
||||||
|
## start
|
||||||
|
|
||||||
|
Start the rendering
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** rendering has started
|
||||||
|
|
||||||
|
## attachTo
|
||||||
|
|
||||||
|
Call to attach the container to an element in the dom
|
||||||
|
Container must be attached before rendering can begin
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `element` **[element](https://developer.mozilla.org/en-US/docs/Web/API/Element)** to attach to
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
|
||||||
|
|
||||||
|
## display
|
||||||
|
|
||||||
|
Display a point in the book
|
||||||
|
The request will be added to the rendering Queue,
|
||||||
|
so it will wait until book is opened, rendering started
|
||||||
|
and all other rendering tasks have finished to be called.
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `target` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Url or EpubCFI
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
|
||||||
|
|
||||||
|
## moveTo
|
||||||
|
|
||||||
|
Move the Rendition to a specific offset
|
||||||
|
Usually you would be better off calling display()
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `offset` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
||||||
|
|
||||||
|
## next
|
||||||
|
|
||||||
|
Go to the next "page" in the rendition
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
|
||||||
|
|
||||||
|
## prev
|
||||||
|
|
||||||
|
Go to the previous "page" in the rendition
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
|
||||||
|
|
||||||
|
## flow
|
||||||
|
|
||||||
|
Adjust the flow of the rendition to paginated or scrolled
|
||||||
|
(scrolled-continuous vs scrolled-doc are handled by different view managers)
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `flow` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
|
||||||
|
## layout
|
||||||
|
|
||||||
|
Adjust the layout of the rendition to reflowable or pre-paginated
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `settings` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
||||||
|
|
||||||
|
## spread
|
||||||
|
|
||||||
|
Adjust if the rendition uses spreads
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `spread` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** none | auto (TODO: implement landscape, portrait, both)
|
||||||
|
- `min` **int** min width to use spreads at
|
||||||
|
|
||||||
|
## reportLocation
|
||||||
|
|
||||||
|
Report the current location
|
||||||
|
|
||||||
|
## destroy
|
||||||
|
|
||||||
|
Remove and Clean Up the Rendition
|
||||||
|
|
||||||
|
## range
|
||||||
|
|
||||||
|
Get a Range from a Visible CFI
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `cfi` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** EpubCfi String
|
||||||
|
- `ignoreClass` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
||||||
|
|
||||||
|
Returns **[range](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input)**
|
||||||
|
|
||||||
|
## adjustImages
|
||||||
|
|
||||||
|
Hook to adjust images to fit in columns
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `view` **View**
|
||||||
|
|
||||||
|
# Hook
|
||||||
|
|
||||||
|
Hooks allow for injecting functions that must all complete in order before finishing
|
||||||
|
They will execute in parallel but all must finish before continuing
|
||||||
|
Functions may return a promise if they are asycn.
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `context` **any** scope of this
|
||||||
|
|
||||||
|
**Examples**
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
this.content = new EPUBJS.Hook(this);
|
||||||
|
```
|
||||||
|
|
||||||
|
## register
|
||||||
|
|
||||||
|
Adds a function to be run before a hook completes
|
||||||
|
|
||||||
|
**Examples**
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
this.content.register(function(){...});
|
||||||
|
```
|
||||||
|
|
||||||
|
## trigger
|
||||||
|
|
||||||
|
Triggers a hook to run all functions
|
||||||
|
|
||||||
|
**Examples**
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
this.content.trigger(args).then(function(){...});
|
||||||
|
```
|
||||||
|
|
||||||
|
# Queue
|
||||||
|
|
||||||
|
Queue for handling tasks one at a time
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `context` **scope** what this will resolve to in the tasks
|
||||||
|
|
||||||
|
## enqueue
|
||||||
|
|
||||||
|
Add an item to the queue
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
|
||||||
|
|
||||||
|
## dequeue
|
||||||
|
|
||||||
|
Run one item
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
|
||||||
|
|
||||||
|
## run
|
||||||
|
|
||||||
|
Run all tasks sequentially, at convince
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
|
||||||
|
|
||||||
|
## flush
|
||||||
|
|
||||||
|
Flush all, as quickly as possible
|
||||||
|
|
||||||
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
|
||||||
|
|
||||||
|
## clear
|
||||||
|
|
||||||
|
Clear all items in wait
|
||||||
|
|
||||||
|
## length
|
||||||
|
|
||||||
|
Get the number of tasks in the queue
|
||||||
|
|
||||||
|
Returns **int** tasks
|
||||||
|
|
||||||
|
## pause
|
||||||
|
|
||||||
|
Pause a running queue
|
||||||
|
|
||||||
|
# Layout
|
||||||
|
|
||||||
|
Figures out the CSS to apply for a layout
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `settings` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
||||||
|
- `settings.spread` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]**
|
||||||
|
|
||||||
|
## flow
|
||||||
|
|
||||||
|
Switch the flow between paginated and scrolled
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `flow` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** paginated | scrolled
|
||||||
|
|
||||||
|
## spread
|
||||||
|
|
||||||
|
Switch between using spreads or not, and set the
|
||||||
|
width at which they switch to single.
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `spread` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** true | false
|
||||||
|
- `min` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** integer in pixels
|
||||||
|
|
||||||
|
## calculate
|
||||||
|
|
||||||
|
Calculate the dimensions of the pagination
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `_width` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** [description]
|
||||||
|
- `_height` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** [description]
|
||||||
|
- `_gap` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** [description]
|
||||||
|
|
||||||
|
## format
|
||||||
|
|
||||||
|
Apply Css to a Document
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `contents` **Contents**
|
||||||
|
|
||||||
|
Returns **\[[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)]**
|
||||||
|
|
||||||
|
## count
|
||||||
|
|
||||||
|
Count number of pages
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
- `totalWidth` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)**
|
||||||
|
|
||||||
|
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** spreads
|
||||||
|
|
||||||
|
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** pages
|
||||||
|
|
11
src/book.js
11
src/book.js
|
@ -27,12 +27,20 @@ var CONTAINER_PATH = "META-INF/container.xml";
|
||||||
* @param {boolean} [options.requestCredentials=undefined] send the xhr request withCredentials
|
* @param {boolean} [options.requestCredentials=undefined] send the xhr request withCredentials
|
||||||
* @param {object} [options.requestHeaders=undefined] send the xhr request headers
|
* @param {object} [options.requestHeaders=undefined] send the xhr request headers
|
||||||
* @param {string} [options.encoding=binary] optional to pass 'binary' or base64' for archived Epubs
|
* @param {string} [options.encoding=binary] optional to pass 'binary' or base64' for archived Epubs
|
||||||
* @param {string} [options.replacements=base64] use base64, blobs, or none for replacing assets in archived Epubs
|
* @param {string} [options.replacements=base64] use base64, blobUrl, or none for replacing assets in archived Epubs
|
||||||
* @returns {Book}
|
* @returns {Book}
|
||||||
* @example new Book("/path/to/book.epub", {})
|
* @example new Book("/path/to/book.epub", {})
|
||||||
|
* @example new Book({ replacements: "blobUrl" })
|
||||||
*/
|
*/
|
||||||
function Book(url, options){
|
function Book(url, options){
|
||||||
|
|
||||||
|
// Allow passing just options to the Book
|
||||||
|
if (typeof(options) === "undefined"
|
||||||
|
&& typeof(url) === "object") {
|
||||||
|
options = url;
|
||||||
|
url = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
this.settings = core.extend(this.settings || {}, {
|
this.settings = core.extend(this.settings || {}, {
|
||||||
requestMethod: undefined,
|
requestMethod: undefined,
|
||||||
requestCredentials: undefined,
|
requestCredentials: undefined,
|
||||||
|
@ -230,6 +238,7 @@ Book.prototype.openPackaging = function(url){
|
||||||
*/
|
*/
|
||||||
Book.prototype.load = function (path) {
|
Book.prototype.load = function (path) {
|
||||||
var resolved;
|
var resolved;
|
||||||
|
|
||||||
if(this.archived) {
|
if(this.archived) {
|
||||||
resolved = this.resolve(path);
|
resolved = this.resolve(path);
|
||||||
return this.archive.request(resolved);
|
return this.archive.request(resolved);
|
||||||
|
|
|
@ -555,8 +555,8 @@ function blob2base64(blob, cb) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// From: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred#backwards_forwards_compatible
|
||||||
function defer() {
|
function defer() {
|
||||||
// From: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred#backwards_forwards_compatible
|
|
||||||
/* A method to resolve the associated Promise with the value passed.
|
/* A method to resolve the associated Promise with the value passed.
|
||||||
* If the promise is already settled it does nothing.
|
* If the promise is already settled it does nothing.
|
||||||
*
|
*
|
||||||
|
@ -575,6 +575,8 @@ function defer() {
|
||||||
*/
|
*/
|
||||||
this.reject = null;
|
this.reject = null;
|
||||||
|
|
||||||
|
this.id = uuid();
|
||||||
|
|
||||||
/* A newly created Pomise object.
|
/* A newly created Pomise object.
|
||||||
* Initially in pending state.
|
* Initially in pending state.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -39,6 +39,10 @@ function Rendition(book, options) {
|
||||||
|
|
||||||
core.extend(this.settings, options);
|
core.extend(this.settings, options);
|
||||||
|
|
||||||
|
if (typeof(this.settings.manager) === "object") {
|
||||||
|
this.manager = this.settings.manager;
|
||||||
|
}
|
||||||
|
|
||||||
this.viewSettings = {
|
this.viewSettings = {
|
||||||
ignoreClass: this.settings.ignoreClass
|
ignoreClass: this.settings.ignoreClass
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue