UNPKG

@magicbell/core

Version:

Official MagicBell API wrapper

35 lines (34 loc) 856 B
import Store, { Identifiable } from './Store.js'; export interface IPagination { total: number; totalPages: number; page: number; perPage: number; currentPage: number; } /** * A store that keep tracks of pagination as well. * * @example * const store = new PaginatedStore(); * store.push(model); */ export default class PaginatedStore<T extends Identifiable> extends Store<T> { total: number; totalPages: number; page: number; perPage: number; currentPage: number; get hasNextPage(): boolean; /** * Add a model at the end of the `items` array. */ push(model: T): boolean; /** * Remove a model from the `items` array. * * If you want to delete a model from the server, use the `delete` method of * the model object instead. */ remove(model: T): boolean; }