Funnel
Extends:
A Funnel is a special type of Stream that combines the states from feeder streams.
Constructor Summary
Public Constructor | ||
public |
constructor(sourceMap: Immutable.Map): Funnel A Funnel is a special type of Stream that combines the states from feeder streams. |
Method Summary
Public Methods | ||
public |
destroy() destroy - cleans up a Funnel's feeder subscribers. |
|
public |
forceState(state: Immutable) forceState - Funnels can accept new state an send state back up the subscription chain. |
|
public |
subscribe - Overwrites base Stream class's subscribe method. Funnels should not emit state to subscribers until all source streams have defined state. |
Inherited Summary
From class Stream | ||
public get |
state: Immutable: * get state - a getter for returning the current internal state of the Stream. |
|
public set |
state(newState: type): type: * set state - a setter that's probably more clever than it needs to be. Instead of setting
the internal state, it calls
Like I said, maybe too clever, but I thinks allow for a more delarative style when writing transformers. |
|
public |
forceState(state: Immutable.Map) forceState - called when hydrating state from another source. |
|
public |
logStack - Adds a stack to automatically add state changes. |
|
public |
next(newState: Immutable) next - Receives new state (externally, ideally through a transformer) and verifies that the
new state is different from the Stream's current state before passing on to |
|
public |
subscribe - takes a callback function that is executed any time the stream received new state. |
Public Constructors
public constructor(sourceMap: Immutable.Map): Funnel source
A Funnel is a special type of Stream that combines the states from feeder streams. Once all of the feeder streams have sent state, the Funnel will send the combined state to any observers. When creating the Funnel, the sourceMap describes the shape of the combined state. The key for each stream will be the key used to access the state of that stream on the combined state object.
Override:
Stream#constructorParams:
Name | Type | Attribute | Description |
sourceMap | Immutable.Map | a Map of the feeder streams. |
Public Methods
public forceState(state: Immutable) source
forceState - Funnels can accept new state an send state back up the subscription chain. This should only be used in cases of restoring state.
Override:
Stream#forceStateParams:
Name | Type | Attribute | Description |
state | Immutable | The new state to hydrate the funnel. |
public subscribe(observer: function): object source
subscribe - Overwrites base Stream class's subscribe method. Funnels should not emit state to subscribers until all source streams have defined state.
Override:
Stream#subscribeParams:
Name | Type | Attribute | Description |
observer | function | the obeserver function to listen to state changes. |