melonJS
    Preparing search index...

    Function push

    • Push back an object instance into the object pool
      Object pooling for the object class must be enabled, and object must have been instantiated using pull, otherwise this function won't work

      Reports failure by RETURNING FALSE. It used to throw by default, and nothing at the call site made that visible: a class that was never registered, or registered without recycling, aborted whatever was running. Both of the internal uses removed in 20.7.0 failed that way, inside a destroy() that had already recycled other state, which left a half-torn-down object to die later somewhere unrelated. Pass throwOnError to opt back in where a missed registration is a bug you want to hear about immediately.

      Parameters

      • obj: object

        instance to be recycled

      • OptionalthrowOnError: boolean = false

        throw an exception instead of returning false

      Returns boolean

      true if the object was successfully recycled in the object pool

      when the object cannot be recycled AND throwOnError is true