File tree Expand file tree Collapse file tree 1 file changed +27
-17
lines changed Expand file tree Collapse file tree 1 file changed +27
-17
lines changed Original file line number Diff line number Diff line change @@ -11,33 +11,43 @@ export default class Prefill {
11
11
return ;
12
12
}
13
13
14
- let distance = this . ias . distance ( ) ;
15
-
16
- if ( distance > 0 ) {
17
- return ;
18
- }
19
-
20
14
this . ias . emitter . emit ( Events . PREFILL ) ;
21
15
22
- return this . _prefill ( ) . then ( ( ) => {
16
+ return Promise . all ( [ this . _prefillNext ( ) , this . _prefillPrev ( ) ] ) . then ( ( ) => {
23
17
this . ias . emitter . emit ( Events . PREFILLED ) ;
24
18
25
19
// @todo reevaluate if we should actually call `measure` here.
26
20
this . ias . measure ( ) ;
27
21
} ) ;
28
22
}
29
23
30
- _prefill ( ) {
31
- return this . ias . next ( ) . then ( ( hasNextUrl ) => {
32
- if ( ! hasNextUrl ) {
33
- return ;
34
- }
24
+ _prefillNext ( ) {
25
+ let distance = this . ias . distance ( ) ;
26
+
27
+ if ( distance > 0 ) {
28
+ return ;
29
+ }
30
+
31
+ return this . ias . next ( )
32
+ . then ( ( hasNextUrl ) => {
33
+ if ( ! hasNextUrl ) {
34
+ return ;
35
+ }
35
36
36
- let distance = this . ias . distance ( ) ;
37
+ let distance = this . ias . distance ( ) ;
37
38
38
- if ( distance < 0 ) {
39
- return this . _prefill ( ) ;
40
- }
41
- } ) ;
39
+ if ( distance < 0 ) {
40
+ return this . _prefillNext ( ) ;
41
+ }
42
+ } )
43
+ ;
44
+ }
45
+
46
+ _prefillPrev ( ) {
47
+ if ( ! this . ias . options . prev ) {
48
+ return ;
49
+ }
50
+
51
+ return this . ias . prev ( ) ;
42
52
}
43
53
}
You can’t perform that action at this time.
0 commit comments