Morearty mixin.
- Source:
Methods
(static) addBindingListener(bindingopt, subpathopt, cb) → {String}
Add binding listener. Listener will be automatically removed on unmount.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
binding |
Binding |
<optional> |
binding to attach listener to, default binding if omitted |
subpath |
String | Array |
<optional> |
subpath as a dot-separated string or an array of strings and numbers |
cb |
function | function receiving changes descriptor |
- Source:
Returns:
listener id
- Type
- String
(static) getBinding(nameopt) → {Binding|Object}
Get component state binding. Returns binding specified in component's binding attribute.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String |
<optional> |
binding name (can only be used with multi-binding state) |
- Source:
Returns:
component state binding
- Type
- Binding | Object
(static) getDefaultBinding() → {Binding}
Get default component state binding. Use this to get component's binding.
Default binding is single binding for single-binding components or binding with key 'default' for multi-binding components or else first observed binding, if any. This method allows smooth migration from single to multi-binding components, e.g. you start with:
{ binding: foo }
or
{ binding: { default: foo } }
or even
{ binding: { any: foo } }
and add more bindings later:
{ binding: { default: foo, aux: auxiliary } }
This way code changes stay minimal.
- Source:
Returns:
default component state binding
- Type
- Binding
(static) getMoreartyContext() → {Context}
Get Morearty context.
- Source:
Returns:
- Type
- Context
(static) getPreviousState(nameopt) → {*}
Get component previous state value.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String |
<optional> |
binding name (can only be used with multi-binding state) |
- Source:
Returns:
previous component state value
- Type
- *
(static) observeBinding(binding, cbopt) → {*}
Consider specified binding for changes when rendering. Registering same binding twice has no effect.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
binding |
Binding | ||
cb |
function |
<optional> |
optional callback receiving binding value |
- Source:
Returns:
undefined if cb argument is ommitted, cb invocation result otherwise
- Type
- *