@@ -52,11 +52,10 @@ proto.loadNextPage = function() {
5252 this . isLoading = true ;
5353 if ( typeof fetchOptions == 'function' ) fetchOptions = fetchOptions ( ) ;
5454
55- // TODO add fetch options
5655 let fetchPromise = fetch ( path , fetchOptions ) . then ( ( response ) => {
5756 if ( ! response . ok ) {
5857 let error = new Error ( response . statusText ) ;
59- this . onPageError ( error , path ) ;
58+ this . onPageError ( error , path , response ) ;
6059 return { response } ;
6160 }
6261
@@ -74,7 +73,7 @@ proto.loadNextPage = function() {
7473 } ) ;
7574 } ) ;
7675
77- this . dispatchEvent ( 'request' , null , [ path ] ) ;
76+ this . dispatchEvent ( 'request' , null , [ path , fetchPromise ] ) ;
7877
7978 return fetchPromise ;
8079} ;
@@ -108,7 +107,7 @@ proto.appendNextPage = function( body, path, response ) {
108107 let appendReady = ( ) => {
109108 this . appendItems ( items , fragment ) ;
110109 this . isLoading = false ;
111- this . dispatchEvent ( 'append' , null , [ body , path , items ] ) ;
110+ this . dispatchEvent ( 'append' , null , [ body , path , items , response ] ) ;
112111 return promiseValue ;
113112 } ;
114113
@@ -215,10 +214,10 @@ proto.lastPageReached = function( body, path ) {
215214
216215// ----- error ----- //
217216
218- proto . onPageError = function ( error , path ) {
217+ proto . onPageError = function ( error , path , response ) {
219218 this . isLoading = false ;
220219 this . canLoad = false ;
221- this . dispatchEvent ( 'error' , null , [ error , path ] ) ;
220+ this . dispatchEvent ( 'error' , null , [ error , path , response ] ) ;
222221 return error ;
223222} ;
224223
0 commit comments