Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
showEpub() {
// 生成Book对象
this.book = new Epub(DOWNLOAD_URL)
// 通过Book.renderTo生成Rendition对象
this.rendition = this.book.renderTo('read', {
width: window.innerWidth,
height: window.innerHeight,
// 兼容iOS
method: 'default'
})
// 通过Rendtion.display渲染电子书
this.rendition.display()
// 获取Theme对象
this.themes = this.rendition.themes
// 设置默认字体
this.setFontSize(this.defaultFontSize)
// 注册主题
this.registerTheme()
// 设置默认主题
_loadBook(bookUrl) {
__DEV__ && console.log("loading book: ", bookUrl);
this.book = ePub({
replacements: this.props.base64 || "none"
});
return this._openBook(bookUrl);
/*
var type = this.book.determineType(bookUrl);
var uri = new Uri(bookUrl);
if ((type === "directory") || (type === "opf")) {
return this._openBook(bookUrl);
} else {
return this.streamer.start()
.then((localOrigin) => {
this.setState({localOrigin})
return this.streamer.get(bookUrl);
constructor(props) {
super(props);
this.book = ePub();
this._visibleLocation = 0;
}