The basic building block for the resolve system.

Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise), and the unwrapped-when-complete (.data) result of the resolveFn.

Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the resolveFn) and returns the resulting promise.

Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first parameter to those fns.

### Hierarchy

- Resolvable

### Implements

- ResolvableLiteral

## Index

### Constructors

- constructor

### Properties

- data
- deps
- policy
- promise
- resolveFn
- resolved
- token

### Methods

- clone
- get
- getPolicy
- resolve
- toString
- fromData

## Constructors

- new Resolvable(resolvable: Resolvable): Resolvable

- This constructor creates a Resolvable copy

- new Resolvable(resolvable: ResolvableLiteral): Resolvable

- This constructor creates a new Resolvable from the plain old ResolvableLiteral javascript object

- new Resolvable(token: any, resolveFn: Function, deps?: any[], policy?: ResolvePolicy, data?: any): Resolvable

- This constructor creates a new `Resolvable`

- This constructor creates a Resolvable copy

  #### Example:

      var resolvable1 = new Resolvable('mytoken', http => http.get('foo.json').toPromise(), [Http]);

      var resolvable2 = new Resolvable(UserService, dep => new UserService(dep.data), [SomeDependency]);

      var resolvable1Clone = new Resolvable(resolvable1);

  #### Parameters

  - ##### resolvable Resolvable

  #### Returns Resolvable

  - Defined in resolve/resolvable.ts:48

- This constructor creates a new Resolvable from the plain old ResolvableLiteral javascript object

  #### Example:

      var resolvable1 = new Resolvable('mytoken', http => http.get('foo.json').toPromise(), [Http]);

      var resolvable2 = new Resolvable(UserService, dep => new UserService(dep.data), [SomeDependency]);

      var resolvable1Clone = new Resolvable(resolvable1);

  #### Parameters

  - ##### resolvable ResolvableLiteral

  #### Returns Resolvable

  - Defined in resolve/resolvable.ts:51

- This constructor creates a new `Resolvable`

  #### Example:

      var resolvable1 = new Resolvable('mytoken', http => http.get('foo.json').toPromise(), [Http]);

      var resolvable2 = new Resolvable(UserService, dep => new UserService(dep.data), [SomeDependency]);

      var resolvable1Clone = new Resolvable(resolvable1);

  #### Parameters

  - ##### token any

    :

    The new resolvable's injection token, such as `"userList"` (a string) or `UserService` (a class). When this token is used during injection, the resolved value will be injected.

  - ##### resolveFn Function

    :

    The function that returns the resolved value, or a promise for the resolved value

  - ##### deps: Optional any[]

    :

    An array of dependencies, which will be injected into the `resolveFn`

  - ##### policy: Optional ResolvePolicy

    :

    the ResolvePolicy defines when and how the Resolvable is processed

  - ##### data: Optional any

    :

    Pre-resolved data. If the resolve value is already known, it may be provided here.

  #### Returns Resolvable

  - Defined in resolve/resolvable.ts:54

## Properties

data: any

Implementation of ResolvableLiteral.data

- Defined in resolve/resolvable.ts:43

deps: any[]

Implementation of ResolvableLiteral.deps

- Defined in resolve/resolvable.ts:41

policy: ResolvePolicy

Implementation of ResolvableLiteral.policy

- Defined in resolve/resolvable.ts:39

promise: Promise<any> = undefined

- Defined in resolve/resolvable.ts:45

resolveFn: Function

Implementation of ResolvableLiteral.resolveFn

- Defined in resolve/resolvable.ts:40

resolved: boolean = false

- Defined in resolve/resolvable.ts:44

token: any

Implementation of ResolvableLiteral.token

- Defined in resolve/resolvable.ts:38

## Methods

- clone(): Resolvable

- #### Returns Resolvable

  - Defined in resolve/resolvable.ts:174

- get(resolveContext: ResolveContext, trans?: Transition): Promise<any>

- Gets a promise for this Resolvable's data.

- Gets a promise for this Resolvable's data.

  Fetches the data and returns a promise. Returns the existing promise if it has already been fetched once.

  #### Parameters

  - ##### resolveContext ResolveContext

  - ##### trans: Optional Transition

  #### Returns Promise<any>

  - Defined in resolve/resolvable.ts:166

- getPolicy(state: StateObject): ResolvePolicy

- #### Parameters

  - ##### state StateObject

  #### Returns ResolvePolicy

  - Defined in resolve/resolvable.ts:97

- resolve(resolveContext: ResolveContext, trans?: Transition): Promise<any>

- Asynchronously resolve this Resolvable's data

- Asynchronously resolve this Resolvable's data

  Given a ResolveContext that this Resolvable is found in: Wait for this Resolvable's dependencies, then invoke this Resolvable's function and update the Resolvable's state

  #### Parameters

  - ##### resolveContext ResolveContext

  - ##### trans: Optional Transition

  #### Returns Promise<any>

  - Defined in resolve/resolvable.ts:113

- toString(): string

- #### Returns string

  - Defined in resolve/resolvable.ts:170

- fromData(token: any, data: any): Resolvable

- #### Parameters

  - ##### token any

  - ##### data any

  #### Returns Resolvable

  - Defined in resolve/resolvable.ts:47

Generated using TypeDoc