// Type definitions for backbone.paginator 2.0.2 // Project: https://github.com/backbone-paginator/backbone.paginator // Definitions by: Nyamazing // Definitions: https://github.com/borisyankov/DefinitelyTyped /// declare module Backbone { interface PageableState { firstPage?: number; lastPage?: number; currentPage?: number; pageSize?: number; totalPages?: number; totalRecords?: number; sortKey?: string; order?: number; } interface PageableQueryParams { currentPage?: string; pageSize?: string; totalPages?: string; totalRecords?: string; sortKey?: string; order?: string; directions?: any; } interface PageableInitialOptions { comparator?: (...options: any[]) => number; full?: boolean; state?: PageableState; queryParam?: PageableQueryParams; } interface PageableParseLinksOptions { xhr?: JQueryXHR; } interface PageableSetSortingOptions { side?: string; full?: boolean; sortValue?: (model: TModel, sortKey: string) => any | string; } interface PageableSwitchModeOptions { fetch?: boolean; resetState?: boolean; } type PageableGetPageOptions = CollectionFetchOptions|Silenceable; class PageableCollection extends Collection{ fullCollection: Collection; mode: string; queryParams: PageableQueryParams; state: PageableState; constructor(models?: TModel[], options?: PageableInitialOptions); fetch(options?: CollectionFetchOptions): JQueryXHR; getFirstPage(options?: PageableGetPageOptions): JQueryXHR|PageableCollection; getLastPage(options?: PageableGetPageOptions): JQueryXHR|PageableCollection; getNextPage(options?: PageableGetPageOptions): JQueryXHR|PageableCollection; getPage(index: number|string, options?: PageableGetPageOptions): JQueryXHR|PageableCollection; getPageByOffset(offset: number, options?: PageableGetPageOptions): JQueryXHR|PageableCollection; getPreviousPage(options?: PageableGetPageOptions): JQueryXHR|PageableCollection; hasNextPage(): boolean; hasPreviousPage(): boolean; parse(resp: any, options?: any): any[]; parseLinks(resp: any, options?: PageableParseLinksOptions): any; parseRecords(resp: any, options?: any): any[]; parseState(resp: any, queryParams: PageableQueryParams, state: PageableState, options?: any): PageableState; setPageSize(pageSize: number, options?: CollectionFetchOptions): JQueryXHR|PageableCollection; setSorting(sortKey: string, order?: number, options?: PageableSetSortingOptions): PageableCollection; switchMode(mode?: string, options?: PageableSwitchModeOptions): JQueryXHR|PageableCollection; sync(method: string, model: TModel|Collection, options?: any): JQueryXHR; static noConflict(): typeof PageableCollection; } }