View
Extends:
A View is a kind of Stream that is useful for transforming the shape of state for use in components or interfaces. A View caches the result of the function, and will only emit state to subscribers if the new return value is distinct from the previous value.
Constructor Summary
Public Constructor | ||
public |
constructor(source: Stream, viewFn: function): View constructor - Takes a source stream, and transforms it through a function. |
Method Summary
Public Methods | ||
public |
destroy() destroy - Clean up subscriptions. |
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(source: Stream, viewFn: function): View source
constructor - Takes a source stream, and transforms it through a function. The view function takes state from the source stream and transforms it into returns a new shape of the state for use in a component or interface.