src/windows/sitewaertsdocumentviewer/js/pdfviewer.js
function (requestIndex, countBefore, countAfter) {
                                if (requestIndex >= pages.length)
                                    return WinJS.Promise.wrapError(
                                            new WinJS.ErrorFromName(
                                                    WinJS.UI.FetchError.doesNotExist));

                                // countBefore = Math.min(ctrl.options.pagesToLoad,
                                //         countBefore);
                                // countAfter = Math.min(ctrl.options.pagesToLoad,
                                //         countAfter);

                                var results = [];

                                var fetchIndex = Math.max(
                                        requestIndex - countBefore,
                                        0);
                                var lastFetchIndex = Math.min(
                                        requestIndex + countAfter,
                                        pages.length - 1);

                                pages[requestIndex].triggerLoad(); // trigger image generator on requested page first

                                for (var i = fetchIndex; i <= lastFetchIndex;
                                     i++)
                                {
                                    /**
                                     * @type Page
                                     */
                                    var page = pages[i];
                                    //page.triggerLoad(); // trigger image generator on requested pages
                                    results.push(
                                            {key: i.toString(), data: page});
                                }


                                pdfViewer.setFocusedPageIndex(requestIndex);

                                // implements IFetchResult
                                return WinJS.Promise.wrap({
                                    absoluteIndex: requestIndex,
                                    items: results, // The array of items.
                                    offset: requestIndex - fetchIndex, // The index of the requested item in the items array.
                                    totalCount: pages.length, // The total number of records. This is equal to total number of pages in a PDF file ,
                                    atStart: fetchIndex === 0,
                                    atEnd: fetchIndex === pages.length - 1
                                });
                            }
function (requestIndex, countBefore, countAfter) {
                                if (requestIndex >= pages.length)
                                    return WinJS.Promise.wrapError(
                                            new WinJS.ErrorFromName(
                                                    WinJS.UI.FetchError.doesNotExist));

                                // countBefore = Math.min(ctrl.options.pagesToLoad,
                                //         countBefore);
                                // countAfter = Math.min(ctrl.options.pagesToLoad,
                                //         countAfter);

                                var results = [];

                                var fetchIndex = Math.max(
                                        requestIndex - countBefore,
                                        0);
                                var lastFetchIndex = Math.min(
                                        requestIndex + countAfter,
                                        pages.length - 1);

                                pages[requestIndex].triggerLoad(); // trigger image generator on requested page first

                                for (var i = fetchIndex; i <= lastFetchIndex;
                                     i++)
                                {
                                    /**
                                     * @type Page
                                     */
                                    var page = pages[i];
                                    //page.triggerLoad(); // trigger image generator on requested pages
                                    results.push(
                                            {key: i.toString(), data: page});
                                }


                                pdfViewer.setFocusedPageIndex(requestIndex);

                                // implements IFetchResult
                                return WinJS.Promise.wrap({
                                    absoluteIndex: requestIndex,
                                    items: results, // The array of items.
                                    offset: requestIndex - fetchIndex, // The index of the requested item in the items array.
                                    totalCount: pages.length, // The total number of records. This is equal to total number of pages in a PDF file ,
                                    atStart: fetchIndex === 0,
                                    atEnd: fetchIndex === pages.length - 1
                                });
                            }
function ( requestIndex , countBefore , countAfter ) { if ( requestIndex >= pages . length ) return WinJS . Promise . wrapError ( new WinJS . ErrorFromName ( WinJS . UI . FetchError . doesNotExist ) ) ; // countBefore = Math.min(ctrl.options.pagesToLoad,
 //         countBefore);
 // countAfter = Math.min(ctrl.options.pagesToLoad,
 //         countAfter);
 var results = [ ] ; var fetchIndex = Math . max ( requestIndex - countBefore , 0 ) ; var lastFetchIndex = Math . min ( requestIndex + countAfter , pages . length - 1 ) ; pages [ requestIndex ] . triggerLoad ( ) ; // trigger image generator on requested page first
 for ( var i = fetchIndex ; i <= lastFetchIndex ; i ++ ) { /**
                                     * @type Page
                                     */ var page = pages [ i ] ; //page.triggerLoad(); // trigger image generator on requested pages
 results . push ( { key : i . toString ( ) , data : page } ) ; } pdfViewer . setFocusedPageIndex ( requestIndex ) ; // implements IFetchResult
 return WinJS . Promise . wrap ( { absoluteIndex : requestIndex , items : results , // The array of items.
 offset : requestIndex - fetchIndex , // The index of the requested item in the items array.
 totalCount : pages . length , // The total number of records. This is equal to total number of pages in a PDF file ,
 atStart : fetchIndex === 0 , atEnd : fetchIndex === pages . length - 1 } ) ; }
Called by the virtualized data source to fetch items It will request a specific item and optionally ask for a number of items on either side of the requested item. The implementation should return the specific item and, in addition, can choose to return a range of items on either side of the requested index. The number of extra items returned by the implementation can be more or less than the number requested.
Called by the virtualized data source to fetch items It will request a specific item and optionally ask for a number of items on either side of the requested item . The implementation should return the specific item and in addition can choose to return a range of items on either side of the requested index . The number of extra items returned by the implementation can be more or less than the number requested .