Skip to content

ListLoop API

Contructor()

Create a new ListLoop instance.

  • type: class

    ts
    export 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

    ts
    import { ListLoop } from "@shihongxins/utils";
    const lp = new ListLoop();

Instance properties

The instance properties.

ListLoop.prototype.list: T[]

Get the list of instance.

  • example

    ts
    console.log(lp.list);

ListLoop.prototype.count: number

Get the count(step) of instance.

  • example

    ts
    console.log(lp.count);

ListLoop.prototype.index: number

Get the index of instance.

  • example

    ts
    console.log(lp.index);

ListLoop.prototype.total: number

Get the total(getter()) of instance.

  • example

    ts
    console.log(lp.total);

ListLoop.prototype.lastRound(): number

Set last round of index.

  • example

    ts
    console.log(lp.lastRound());

ListLoop.prototype.nextRound(): number

Set next round of index.

  • example

    ts
    console.log(lp.nextRound());

ListLoop.prototype.currentRoundList: T[]

Get current round list of instance.

  • example

    ts
    console.log(lp.currentRoundList);