Home Reference Source Test
public class | source

Store

Extends:

StateHolder → Store

Class to represent a Store.

Constructor Summary

Public Constructor
public

constructor(dispatcher: Dispatcher)

Creates a new store instance.

Member Summary

Public Members
public
public
public
public

handler: *

Method Summary

Public Methods
public

Activates the store by registering to handle actions.

public

attachStore(name: String, store: Store): Function

Attaches another store to this store's state.

public

Activates the store only if its not activate yet and there's at least one callback registered.

public

Deactivates the store only if its been activated and there aren't any callbacks registered.

public

Activates the store by deregistering the action handler.

public

detachStore(store: Store)

Detaches a previously attached store from this store's state.

public

extend(methods: Object)

Extends the store with given methods.

public

Gets the action handler.

public

Sets the action handler.

public

Called after store is activated.

public

Called before store is activated.

public

Called before store is deactivated.

public

Exports store state to props object.

Private Methods
private

callActionHandler(handler: Function, action: Object)

Calls the action handler.

Public Constructors

public constructor(dispatcher: Dispatcher) source

Creates a new store instance.

Params:

NameTypeAttributeDescription
dispatcher Dispatcher

Public Members

public actionHandler: * source

public attachedStores: * source

public dispatcher: * source

public handler: * source

Public Methods

public activate() source

Activates the store by registering to handle actions.

public attachStore(name: String, store: Store): Function source

Attaches another store to this store's state.

Params:

NameTypeAttributeDescription
name String
store Store

Return:

Function

handler

public autoActivate() source

Activates the store only if its not activate yet and there's at least one callback registered.

public autoDeactivate() source

Deactivates the store only if its been activated and there aren't any callbacks registered.

public deactivate() source

Activates the store by deregistering the action handler.

public detachStore(store: Store) source

Detaches a previously attached store from this store's state.

Params:

NameTypeAttributeDescription
store Store

public extend(methods: Object) source

Extends the store with given methods.

Params:

NameTypeAttributeDescription
methods Object

public getActionHandler(): Function source

Gets the action handler.

Return:

Function

handler

public setActionHandler(handler: Function) source

Sets the action handler.

Params:

NameTypeAttributeDescription
handler Function

public storeDidActivate() source

Called after store is activated.

public storeWillActivate() source

Called before store is activated.

public storeWillDeactivate() source

Called before store is deactivated.

public toProps(): Object source

Exports store state to props object.

Return:

Object

props

Private Methods

private callActionHandler(handler: Function, action: Object) source

Calls the action handler.

Params:

NameTypeAttributeDescription
handler Function
action Object