Class: Context

Context

Represents Morearty context.

Exposed modules:

Constructor

new Context(binding, metaBinding, options)

Morearty context constructor.
Parameters:
Name Type Description
binding Binding state binding
metaBinding Binding meta state binding
options Object options
Source:

Methods

bootstrap(rootComp, reactContextopt) → {*}

Create Morearty bootstrap component ready for rendering.
Parameters:
Name Type Attributes Description
rootComp * root application component
reactContext Object <optional>
custom React context (will be enriched with Morearty-specific data)
Source:
Returns:
Morearty bootstrap component
Type
*

copy(subpathopt) → {Context}

Create a copy of this context sharing same bindings and options.
Parameters:
Name Type Attributes Description
subpath String | Array <optional>
subpath as a dot-separated string or an array of strings and numbers
Source:
Returns:
Type
Context

getBinding() → {Binding}

Get state binding.
Source:
See:
Returns:
state binding
Type
Binding

getCurrentMeta() → {Immutable.Map}

Get current meta state.
Source:
Returns:
current meta state
Type
Immutable.Map

getCurrentState() → {Immutable.Map}

Get current state.
Source:
Returns:
current state
Type
Immutable.Map

getMetaBinding() → {Binding}

Get meta binding.
Source:
See:
Returns:
meta binding
Type
Binding

getPreviousMeta() → {Immutable.Map}

Get previous meta state (before last render).
Source:
Returns:
previous meta state
Type
Immutable.Map

getPreviousState() → {Immutable.Map}

Get previous state (before last render).
Source:
Returns:
previous state
Type
Immutable.Map

init(rootComp)

Initialize rendering.
Parameters:
Name Type Description
rootComp * root application component
Source:

isChanged(binding, subpathopt, compareopt)

Check if binding value was changed on last re-render.
Parameters:
Name Type Attributes Description
binding Binding binding
subpath String | Array <optional>
subpath as a dot-separated string or an array of strings and numbers
compare function <optional>
compare function, '===' for primitives / Immutable.is for collections by default
Source:

queueFullUpdate()

Queue full update on next render.
Source:

replaceState(newState, newMetaStateopt, optionsopt)

Replace whole state with new value.
Parameters:
Name Type Attributes Description
newState Immutable.Map new state
newMetaState Immutable.Map <optional>
new meta state
options Object <optional>
options object
Properties
Name Type Attributes Default Description
notify Boolean <optional>
true should listeners be notified
Source:

resetState(subpathopt, optionsopt)

Revert to initial state.
Parameters:
Name Type Attributes Description
subpath String | Array <optional>
subpath as a dot-separated string or an array of strings and numbers
options Object <optional>
options object
Properties
Name Type Attributes Default Description
notify Boolean <optional>
true should listeners be notified
resetMeta Boolean <optional>
true should meta state be reverted
Source: