File tree Expand file tree Collapse file tree 4 files changed +51
-20
lines changed Expand file tree Collapse file tree 4 files changed +51
-20
lines changed Original file line number Diff line number Diff line change @@ -5,16 +5,7 @@ updates:
5
5
schedule :
6
6
interval : daily
7
7
time : " 04:00"
8
- open-pull-requests-limit : 2
9
- ignore :
10
- - dependency-name : cypress
11
- versions :
12
- - 7.0.0
13
- - 7.0.1
14
- - dependency-name : rollup
15
- versions :
16
- - 2.38.2
17
- - 2.38.4
8
+ open-pull-requests-limit : 4
18
9
- package-ecosystem : npm
19
10
directory : " /examples/articles"
20
11
schedule :
@@ -27,9 +18,33 @@ updates:
27
18
interval : daily
28
19
time : " 04:00"
29
20
open-pull-requests-limit : 2
21
+ - package-ecosystem : npm
22
+ directory : " /examples/button"
23
+ schedule :
24
+ interval : daily
25
+ time : " 04:00"
26
+ open-pull-requests-limit : 2
27
+ - package-ecosystem : npm
28
+ directory : " /examples/json"
29
+ schedule :
30
+ interval : daily
31
+ time : " 04:00"
32
+ open-pull-requests-limit : 2
30
33
- package-ecosystem : npm
31
34
directory : " /examples/masonry"
32
35
schedule :
33
36
interval : daily
34
37
time : " 04:00"
35
38
open-pull-requests-limit : 2
39
+ - package-ecosystem : npm
40
+ directory : " /examples/overflow"
41
+ schedule :
42
+ interval : daily
43
+ time : " 04:00"
44
+ open-pull-requests-limit : 2
45
+ - package-ecosystem : npm
46
+ directory : " /examples/vuejs"
47
+ schedule :
48
+ interval : daily
49
+ time : " 04:00"
50
+ open-pull-requests-limit : 2
Original file line number Diff line number Diff line change @@ -70,9 +70,22 @@ Triggered right after the `hit` event. Indicating that the next page will be loa
70
70
| property | type | description |
71
71
| :--- | :--- | :--- |
72
72
| pageIndex | int | The page index of the next page (the page that is about to be loaded) |
73
+ | promise | Promise | A Promise that is resolved when the next operation finishes |
73
74
74
75
> pageIndex is zero indexed. This means the index starts at 0 on the first page.
75
76
77
+ For example to notify the user about loading the next page, you can do:
78
+
79
+ ``` js
80
+ ias .on (' next' , function (event ) {
81
+ alert (` Page ${ event .pageIndex + 1 } is loading...` );
82
+
83
+ event .promise .then (function () {
84
+ alert (` Page ${ event .pageIndex + 1 } is loaded and added to the page.` );
85
+ });
86
+ });
87
+ ```
88
+
76
89
### load
77
90
78
91
This event is triggered before the next page is requested from the server.
Original file line number Diff line number Diff line change @@ -142,15 +142,11 @@ export default class InfiniteAjaxScroll {
142
142
143
143
this . pause ( ) ;
144
144
145
- let event = {
146
- pageIndex : this . pageIndex + 1 ,
147
- } ;
145
+ const pageIndex = this . pageIndex + 1 ;
148
146
149
- this . emitter . emit ( Events . NEXT , event ) ;
150
-
151
- return Promise . resolve ( this . nextHandler ( event . pageIndex ) )
147
+ const promise = Promise . resolve ( this . nextHandler ( pageIndex ) )
152
148
. then ( ( hasNextUrl ) => {
153
- this . pageIndex = event . pageIndex ;
149
+ this . pageIndex = pageIndex ;
154
150
155
151
if ( ! hasNextUrl ) {
156
152
this . emitter . emit ( Events . LAST ) ;
@@ -161,6 +157,15 @@ export default class InfiniteAjaxScroll {
161
157
this . resume ( ) ;
162
158
} )
163
159
;
160
+
161
+ const event = {
162
+ pageIndex : this . pageIndex + 1 ,
163
+ promise
164
+ } ;
165
+
166
+ this . emitter . emit ( Events . NEXT , event ) ;
167
+
168
+ return promise ;
164
169
}
165
170
166
171
/**
Original file line number Diff line number Diff line change @@ -49,7 +49,6 @@ export default class Paging {
49
49
let url = document . location . toString ( ) ;
50
50
let title = document . title ;
51
51
52
- // @todo can be moved inside appended when eventStack is implemented
53
52
let loaded = ( event ) => {
54
53
url = event . url ;
55
54
@@ -60,7 +59,7 @@ export default class Paging {
60
59
61
60
this . ias . once ( Events . LOADED , loaded ) ;
62
61
63
- this . ias . once ( Events . APPENDED , ( ) => {
62
+ nextEvent . promise . then ( ( ) => {
64
63
this . pageBreaks . push ( {
65
64
pageIndex : nextEvent . pageIndex ,
66
65
url,
@@ -70,7 +69,6 @@ export default class Paging {
70
69
71
70
this . update ( ) ;
72
71
73
- // @todo can be removed when eventStack is implemented
74
72
this . ias . off ( Events . LOADED , loaded ) ;
75
73
} ) ;
76
74
}
You can’t perform that action at this time.
0 commit comments