ListLoop API
Contructor()
Create a new ListLoop instance.
type:
class
tsexport declare class ListLoop<T> { list: T[]; count: number; index: number; constructor(list?: T[], count?: number, index?: number); get total(): number; lastRound(): number; nextRound(): number; get currentRoundList(): T[]; }
example
tsimport { ListLoop } from "@shihongxins/utils"; const lp = new ListLoop();
Instance properties
The instance properties.
ListLoop.prototype.list: T[]
Get the list of instance.
example
tsconsole.log(lp.list);
ListLoop.prototype.count: number
Get the count(step) of instance.
example
tsconsole.log(lp.count);
ListLoop.prototype.index: number
Get the index of instance.
example
tsconsole.log(lp.index);
ListLoop.prototype.total: number
Get the total(getter()
) of instance.
example
tsconsole.log(lp.total);
ListLoop.prototype.lastRound(): number
Set last round of index.
example
tsconsole.log(lp.lastRound());
ListLoop.prototype.nextRound(): number
Set next round of index.
example
tsconsole.log(lp.nextRound());
ListLoop.prototype.currentRoundList: T[]
Get current round list of instance.
example
tsconsole.log(lp.currentRoundList);