Options
All
  • Public
  • Public/Protected
  • All
Menu
classdesc

Creates a DuckEngine Group

description

The Group Class. Contains and manages a group of items

since

1.0.0-beta

Type parameters

  • t

    Stack Item type generic

Hierarchy

  • Group

Index

Constructors

constructor

  • new Group<t>(name: string, game: Game, defaultItems?: t[]): Group<t>
  • description

    Creates a Group instance.

    since

    1.0.0-beta

    Type parameters

    • t

    Parameters

    • name: string

      Name of group

    • game: Game

      Game instance

    • Optional defaultItems: t[]

    Returns Group<t>

Properties

game

game: Game
memberof

Group

description

Game instance

since

1.0.0-beta

Readonly name

name: string
memberof

Group

description

Group name

since

1.0.0-beta

Protected stack

stack: t[]

Accessors

group

  • get group(): t[]

length

  • get length(): number
  • memberof

    Group

    description

    Returns the length of the array

    since

    1.0.0-beta

    Returns number

Methods

add

  • add(item: t): void
  • memberof

    Group

    description

    Adds an item to the Group

    emits

    EVENTS.GROUP.ADD

    since

    1.0.0-beta

    Parameters

    • item: t

      Item to add

    Returns void

at

  • at(index: number): undefined | t
  • memberof

    Group

    description

    Returns an item or undefined at a specified index

    since

    2.1.0

    Parameters

    • index: number

      The index to return a value from, 0-based like an array

    Returns undefined | t

each

  • each(cb: (item: t, index: number) => void): void
  • memberof

    Group

    description

    Loops through each item in the Group array

    since

    1.0.0-beta

    Parameters

    • cb: (item: t, index: number) => void

      Callback function

        • (item: t, index: number): void
        • Parameters

          • item: t
          • index: number

          Returns void

    Returns void

filter

  • memberof

    Group

    description

    Filters items from the Group

    since

    1.0.0-beta

    Parameters

    Returns t[]

find

  • find(item: t): undefined | t
  • memberof

    Group

    description

    Finds an item in the Group

    since

    1.0.0-beta

    Parameters

    • item: t

      Item to find

    Returns undefined | t

indexOf

  • indexOf(item: t): number
  • memberof

    Group

    description

    Gets the index of an item from the Group list array

    since

    1.0.0-beta

    Parameters

    • item: t

      Item to find the index of

    Returns number

off

on

pop

  • pop(): undefined | t
  • memberof

    Group

    description

    Pops an item from the Group array

    since

    1.0.0-beta

    Returns undefined | t

remove

  • remove(item: t): void
  • memberof

    Group

    description

    Removes an item from the Group

    emits

    EVENTS.GROUP.REMOVE

    since

    1.0.0-beta

    Parameters

    • item: t

      Item to remove

    Returns void

shift

  • shift(): undefined | t
  • memberof

    Group

    description

    Shifts an item from the Group array

    since

    1.0.0-beta

    Returns undefined | t

splice

  • splice(index: number, deleteCount?: number): t[]
  • memberof

    Group

    description

    Splices an item from the Group array

    since

    1.0.0-beta

    Parameters

    • index: number

      Index to splice at

    • Optional deleteCount: number

    Returns t[]

Generated using TypeDoc