rfw2d
    Preparing search index...

    Class RefCounts<O>

    Manually reference-count a collection of objects. Will not keep references to objects with a ref-count of 0.

    Type Parameters

    • O
    Index

    Constructors

    Accessors

    • get "[iterator]"(): readonly O[]

      Iterator over the reference-counted objects.

      Returns readonly O[]

    • get refs(): readonly O[]

      Read-only array of the reference-counted objects.

      Returns readonly O[]

    Methods

    • Add a reference to o.

      Parameters

      • o: O

        Object

      Returns number

      New ref-count for o

    • Get the ref-count of o

      Parameters

      • o: O

        Object

      Returns number

      Ref-count, 0 also if the

    • Delete a reference to o.

      Parameters

      • o: O

        Object

      • toZero: boolean = false

        Optional, if true, deletes all references to o

      Returns number

      New ref-count for o

    • Check if o exists (has a ref-count > 0).

      Parameters

      • o: O

        Object

      Returns boolean

      true if ref-count > 0

    • Get index of o in the backing array. Can be used to index RefCounts.refs.

      Parameters

      • o: O

        Ref-counted object

      Returns undefined | number

      Index or undefined