mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
146 lines
3.2 KiB
Markdown
146 lines
3.2 KiB
Markdown
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
|
|
# ePub
|
|
|
|
Creates a new Book
|
|
|
|
**Parameters**
|
|
|
|
- `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.request` the request function to use
|
|
|
|
**Examples**
|
|
|
|
```javascript
|
|
ePub("/path/to/book.epub", {})
|
|
```
|
|
|
|
Returns **[Book](#book)** a new Book object
|
|
|
|
# Book
|
|
|
|
Creates a new Book
|
|
|
|
**Parameters**
|
|
|
|
- `_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.requestMethod` **method** a request function to use instead of the default
|
|
|
|
**Examples**
|
|
|
|
```javascript
|
|
new Book("/path/to/book.epub", {})
|
|
```
|
|
|
|
Returns **[Book](#book)**
|
|
|
|
## url
|
|
|
|
## loaded
|
|
|
|
**Properties**
|
|
|
|
- `loaded.manifest` **[promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A child method as property defination
|
|
|
|
## open
|
|
|
|
open a url
|
|
|
|
**Parameters**
|
|
|
|
- `_url` **[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
|
|
|
|
**Examples**
|
|
|
|
```javascript
|
|
book.open("/path/to/book.epub", { base64: false })
|
|
```
|
|
|
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** of when the book has been loaded
|
|
|
|
## unpack
|
|
|
|
unpack the contents of the Books packageXml
|
|
|
|
**Parameters**
|
|
|
|
- `packageXml` **[document](https://developer.mozilla.org/en-US/docs/Web/JavaScript)** XML Document
|
|
|
|
## section
|
|
|
|
Alias for book.spine.get
|
|
|
|
**Parameters**
|
|
|
|
- `target` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
|
|
## renderTo
|
|
|
|
Sugar to render a book
|
|
|
|
**Parameters**
|
|
|
|
- `element`
|
|
- `options`
|
|
|
|
## requestMethod
|
|
|
|
Switch request methods depending on if book is archived or not
|
|
|
|
**Parameters**
|
|
|
|
- `_url`
|
|
|
|
## unarchive
|
|
|
|
Unarchive a zipped epub
|
|
|
|
**Parameters**
|
|
|
|
- `bookUrl`
|
|
- `isBase64`
|
|
|
|
## isArchivedUrl
|
|
|
|
Checks if url has a .epub or .zip extension, or is ArrayBuffer (of zip/epub)
|
|
|
|
**Parameters**
|
|
|
|
- `bookUrl`
|
|
|
|
## coverUrl
|
|
|
|
Get the cover url
|
|
|
|
## range
|
|
|
|
Find a DOM Range for a given CFI Range
|
|
|
|
**Parameters**
|
|
|
|
- `cfiRange`
|
|
|
|
# EpubCFI
|
|
|
|
EPUB CFI spec: <http://www.idpf.org/epub/linking/cfi/epub-cfi.html>
|
|
|
|
Implements:
|
|
|
|
- Character Offset: epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/2/1:3)
|
|
- Simple Ranges : epubcfi(/6/4[chap01ref]!/4[body01]/10[para05],/2/1:1,/3:4)
|
|
|
|
Does Not Implement:
|
|
|
|
- Temporal Offset (~)
|
|
- Spatial Offset (@)
|
|
- Temporal-Spatial Offset (~ + @)
|
|
- Text Location Assertion (\[)
|
|
|
|
**Parameters**
|
|
|
|
- `cfiFrom`
|
|
- `base`
|
|
- `ignoreClass`
|