### Hierarchy

- StateRegistry

## Index

### Constructors

- constructor

### Properties

- _root
- _router
- builder
- listeners
- matcher
- stateQueue
- states

### Methods

- _registerRoot
- decorator
- deregister
- dispose
- get
- onStatesChanged
- register
- root

## Constructors

- new StateRegistry(_router: UIRouter): StateRegistry

- #### Parameters

  - ##### _router UIRouter

  #### Returns StateRegistry

  - Defined in state/stateRegistry.ts:35

## Properties

_root: StateObject

- Defined in state/stateRegistry.ts:28

_router: UIRouter

- Defined in state/stateRegistry.ts:38

builder: StateBuilder

- Defined in state/stateRegistry.ts:32

listeners: StateRegistryListener[] = []

- Defined in state/stateRegistry.ts:35

matcher: StateMatcher

- Defined in state/stateRegistry.ts:31

stateQueue: StateQueueManager

- Defined in state/stateRegistry.ts:33

states: object

#### Type declaration

- ##### [key: string]: StateObject

- Defined in state/stateRegistry.ts:29

## Methods

- _registerRoot(): void

- #### Returns void

  - Defined in state/stateRegistry.ts:46

- decorator(name: string, func: BuilderFunction): Function | function | function[]

- #### Parameters

  - ##### name string

  - ##### func BuilderFunction

  #### Returns Function | function | function[]

  - Defined in state/stateRegistry.ts:202

- deregister(stateOrName: StateOrName): StateObject[]

- Removes a state from the registry

- Removes a state from the registry

  This removes a state from the registry. If the state has children, they are are also removed from the registry.

  #### Parameters

  - ##### stateOrName StateOrName

    :

    the state's name or object representation

  #### Returns StateObject[]

  :

  a list of removed states

  - Defined in state/stateRegistry.ts:165

- dispose(): void

- #### Returns void

  - Defined in state/stateRegistry.ts:62

- get(): StateDeclaration[]

- Gets all registered states

- get(stateOrName: StateOrName, base?: StateOrName): StateDeclaration

- Gets a registered state

- Gets all registered states

  Calling this method with no arguments will return a list of all the states that are currently registered. Note: this does not return states that are queued but not yet registered.

  #### Returns StateDeclaration[]

  :

  a list of StateDeclarations

  - Defined in state/stateRegistry.ts:182

- Gets a registered state

  Given a state or a name, finds and returns the StateDeclaration from the registry. Note: this does not return states that are queued but not yet registered.

  #### Parameters

  - ##### stateOrName StateOrName

    :

    either the name of a state, or a state object.

  - ##### base: Optional StateOrName

    :

    the base state to use when stateOrName is relative.

  #### Returns StateDeclaration

  :

  a registered StateDeclaration that matched the `stateOrName`, or null if the state isn't registered.

  - Defined in state/stateRegistry.ts:194

- onStatesChanged(listener: StateRegistryListener): function

- Listen for a State Registry events

- Listen for a State Registry events

  Adds a callback that is invoked when states are registered or deregistered with the StateRegistry.

  #### Example:

      let allStates = registry.get();

      // Later, invoke deregisterFn() to remove the listener
      let deregisterFn = registry.onStatesChanged((event, states) => {
        switch(event) {
          case: 'registered':
            states.forEach(state => allStates.push(state));
            break;
          case: 'deregistered':
            states.forEach(state => {
              let idx = allStates.indexOf(state);
              if (idx !== -1) allStates.splice(idx, 1);
            });
            break;
        }
      });

  #### Parameters

  - ##### listener StateRegistryListener

    :

    a callback function invoked when the registered states changes. The function receives two parameters, `event` and `state`. See StateRegistryListener

  #### Returns function

  :

  a function that deregisters the listener

  - - (): void

    - #### Returns void

  - Defined in state/stateRegistry.ts:98

- register(stateDefinition: _StateDeclaration): StateObject

- Adds a state to the registry

- Adds a state to the registry

  Registers a StateDeclaration or queues it for registration.

  Note: a state will be queued if the state's parent isn't yet registered.

  #### Parameters

  - ##### stateDefinition _StateDeclaration

    :

    the definition of the state to register.

  #### Returns StateObject

  :

  the internal StateObject object. If the state was successfully registered, then the object is fully built (See: StateBuilder). If the state was only queued, then the object is not fully built.

  - Defined in state/stateRegistry.ts:130

- root(): StateObject

- Gets the implicit root state

- Gets the implicit root state

  Gets the root of the state tree. The root state is implicitly created by UI-Router. Note: this returns the internal StateObject representation, not a StateDeclaration

  #### Returns StateObject

  :

  the root StateObject

  - Defined in state/stateRegistry.ts:114

Generated using TypeDoc