Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • BehaviorRegistry

Index

Constructors

constructor

Properties

app

Instance of the {@link application.Application} that this registry belongs to.

behaviors

behaviors: object

Collection of Behaviors that are stored within the registry.

Type declaration

dummyBehavior

dummyBehavior: Behavior

Empty behavior to be returned whenever a request for an invalid behavior is made.

Methods

Protected addBehavior

  • addBehavior(name: string, commands: string[], event?: string): void
  • Used to add a new behavior to the registry.

    Parameters

    • name: string

      The name used to access the behavior in the registry.

    • commands: string[]

      An array of commands that define the behavior's actions.

    • Optional event: string

      An (optional) event that can will trigger the behavior.

    Returns void

behavior

  • Used to retreive a stored behavior from the registry. If the behavior does not exist then a dummy behavior is returned.

    Parameters

    • name: string

      The name of the behavior to be retrieved.

    Returns Behavior

loadBehaviorsFromConfig

  • Loads a collection of behaviors from config. Behaviors are stored in a 'behaviors' object, which stores a collection of arrays of commands. Returns an array of the behavior names so that the module can remove them from the registry when it is destroyed.

    Parameters

    • scope: FrameworkObject

      The scope of the calling function - used to ensure that behaviors are only loaded from modules.

    • config: any

      The configuration for the associated module.

    Returns string[]

remove

  • remove(name: string): boolean
  • Used to remove a behavior from the registry. Also unsubscribes the behavior from its event and clears run commands.

    Parameters

    • name: string

      The name used to access the behavior in the registry.

    Returns boolean