File tree Expand file tree Collapse file tree 2 files changed +16
-13
lines changed Expand file tree Collapse file tree 2 files changed +16
-13
lines changed Original file line number Diff line number Diff line change 1
- import React , { Component , findDOMNode } from 'react' ;
1
+ import React , { Component } from 'react' ;
2
2
import ePub from 'epubjs' ;
3
3
import getStreamHost from '../../utils/get-stream-host' ;
4
4
import './Epub.scss' ;
@@ -29,10 +29,6 @@ class Epub extends Component {
29
29
}
30
30
31
31
32
- componentWillUnmount ( ) {
33
- this . _stop ( ) ;
34
- }
35
-
36
32
componentWillUpdate ( nextProps ) {
37
33
if ( nextProps . location !== this . props . location ) {
38
34
this . _visibleLocation = nextProps . location ;
@@ -48,8 +44,15 @@ class Epub extends Component {
48
44
}
49
45
}
50
46
47
+ componentWillUnmount ( ) {
48
+ this . _stop ( ) ;
49
+ }
50
+
51
+
51
52
display ( what ) {
52
- this . rendition && this . rendition . display ( what ) ;
53
+ if ( this . rendition ) {
54
+ this . rendition . display ( what ) ;
55
+ }
53
56
}
54
57
55
58
_start ( ) {
Original file line number Diff line number Diff line change @@ -12,22 +12,22 @@ class Reader extends Component {
12
12
this . handleNavReady = this . handleNavReady . bind ( this ) ;
13
13
}
14
14
15
- componentDidMount ( ) {
15
+ state = {
16
+ isLoading : true ,
17
+ nav : [ ] ,
18
+ location : 0
19
+ } ;
20
+
21
+ componentWillMount ( ) {
16
22
if ( this . props . book ) {
17
23
const location = localStorage . getItem ( `${ this . props . book . id } -location` ) ;
18
24
19
25
if ( location ) {
20
- console . log ( 'location is' , location ) ;
21
26
this . setState ( { ...this . state , location } ) ;
22
27
}
23
28
}
24
29
}
25
30
26
- state = {
27
- isLoading : true ,
28
- nav : [ ] ,
29
- location : 0
30
- } ;
31
31
32
32
handleNavReady ( nav ) {
33
33
this . setState ( { ...this . state , nav } ) ;
You can’t perform that action at this time.
0 commit comments