@@ -52,11 +52,10 @@ proto.loadNextPage = function() {
52
52
this . isLoading = true ;
53
53
if ( typeof fetchOptions == 'function' ) fetchOptions = fetchOptions ( ) ;
54
54
55
- // TODO add fetch options
56
55
let fetchPromise = fetch ( path , fetchOptions ) . then ( ( response ) => {
57
56
if ( ! response . ok ) {
58
57
let error = new Error ( response . statusText ) ;
59
- this . onPageError ( error , path ) ;
58
+ this . onPageError ( error , path , response ) ;
60
59
return { response } ;
61
60
}
62
61
@@ -74,7 +73,7 @@ proto.loadNextPage = function() {
74
73
} ) ;
75
74
} ) ;
76
75
77
- this . dispatchEvent ( 'request' , null , [ path ] ) ;
76
+ this . dispatchEvent ( 'request' , null , [ path , fetchPromise ] ) ;
78
77
79
78
return fetchPromise ;
80
79
} ;
@@ -108,7 +107,7 @@ proto.appendNextPage = function( body, path, response ) {
108
107
let appendReady = ( ) => {
109
108
this . appendItems ( items , fragment ) ;
110
109
this . isLoading = false ;
111
- this . dispatchEvent ( 'append' , null , [ body , path , items ] ) ;
110
+ this . dispatchEvent ( 'append' , null , [ body , path , items , response ] ) ;
112
111
return promiseValue ;
113
112
} ;
114
113
@@ -215,10 +214,10 @@ proto.lastPageReached = function( body, path ) {
215
214
216
215
// ----- error ----- //
217
216
218
- proto . onPageError = function ( error , path ) {
217
+ proto . onPageError = function ( error , path , response ) {
219
218
this . isLoading = false ;
220
219
this . canLoad = false ;
221
- this . dispatchEvent ( 'error' , null , [ error , path ] ) ;
220
+ this . dispatchEvent ( 'error' , null , [ error , path , response ] ) ;
222
221
return error ;
223
222
} ;
224
223
0 commit comments