- Source:
ui-predicate core public API
Members
(static) root
- Source:
Get root CompoundPredicate
Methods
(static) setData(root) → {Promise.<undefined, errors.RootPredicateMustBeACompoundPredicate>}
- Source:
- Since:
- 1.0.0
Set PredicateCore data
Parameters:
Name | Type | Description |
---|---|---|
root
|
dataclasses.CompoundPredicate | CompoundPredicate |
Returns:
resolved promise yield nothing, rejected promise yield RootPredicateMustBeACompoundPredicate error
- Type
- Promise.<undefined, errors.RootPredicateMustBeACompoundPredicate>
(static) add(option) → {Promise.<dataclasses.Predicate>}
- Source:
- Since:
- 1.0.0
Add a ComparisonPredicate or CompoundPredicate
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
option
|
Object | |||
options.type
|
string | what type of Predicate to add | ||
options.how
|
string |
optional
|
after
|
should we insert it before, after or instead of? (currently only after is supported) |
options.where
|
dataclasses.Predicate | current element |
Returns:
inserted predicate
- Type
- Promise.<dataclasses.Predicate>
(static) remove(predicate) → {Promise.<dataclasses.Predicate>}
- Source:
- Since:
- 1.0.0
Remove a ComparisonPredicate or CompoundPredicate
Parameters:
Name | Type | Description |
---|---|---|
predicate
|
dataclasses.ComparisonPredicate | dataclasses.CompoundPredicate |
Returns:
yield the removed predicate, will reject the promise if remove was called with the root CompoundPredicate or the last ComparisonPredicate of the root CompoundPredicate
- Type
- Promise.<dataclasses.Predicate>
(static) setPredicateLogicalType_id(predicate, newLogicalType_id) → {Promise.<undefined, errors.PredicateMustBeACompoundPredicate>}
- Source:
- Since:
- 1.0.0
Change a CompoundPredicate logical
Parameters:
Name | Type | Description |
---|---|---|
predicate
|
dataclasses.CompoundPredicate | |
newLogicalType_id
|
string |
Returns:
yield nothing if everything went right, otherwise yield a reject promise with the PredicateMustBeACompoundPredicate error
- Type
- Promise.<undefined, errors.PredicateMustBeACompoundPredicate>
(static) setPredicateTarget_id(predicate, newTarget_id) → {Promise}
- Source:
- Since:
- 1.0.0
Change a predicate's target
Parameters:
Name | Type | Description |
---|---|---|
predicate
|
dataclasses.ComparisonPredicate | |
newTarget_id
|
string |
Returns:
yield nothing if everything went right, otherwise yield a reject promise with the PredicateMustBeAComparisonPredicate error
- Type
- Promise
(static) setPredicateOperator_id(predicate, newTarget_id) → {Promise.<undefined, errors.PredicateMustBeAComparisonPredicate>}
- Source:
- Since:
- 1.0.0
Change a predicate's operator
Parameters:
Name | Type | Description |
---|---|---|
predicate
|
dataclasses.ComparisonPredicate | |
newTarget_id
|
string |
Returns:
yield nothing if everything went right, otherwise yield a reject promise with the PredicateMustBeAComparisonPredicate error
- Type
- Promise.<undefined, errors.PredicateMustBeAComparisonPredicate>
(static) toJSON() → {Object}
- Source:
- Since:
- 1.0.0
Yield a serializable object without internal flags ($xxx properties)
Example
console.log(JSON.stringify(ctrl, null, 2)); // will call ctrl.toJSON() underneath
Returns:
a serializable object
- Type
- Object
(static) on(eventName, listener)
- Source:
- Since:
- 1.0.0
Adds the `listener` function to the end of the listeners array for the event named `eventName`.
No checks are made to see if the `listener` has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.
Parameters:
Name | Type | Description |
---|---|---|
eventName
|
string | available event names are : (`changed`, api) |
listener
|
function |
(static) once(eventName, listener)
- Source:
- Since:
- 1.0.0
- See:
Adds a *one-time* `listener` function for the event named `eventName`. The next time `eventName` is triggered, this `listener` is removed and then invoked.
Parameters:
Name | Type | Description |
---|---|---|
eventName
|
string | see core.api.on for available event names |
listener
|
function |
(static) off(eventNamenullable, listenernullable)
- Source:
- Since:
- 1.0.0
Remove listener(s)
If off() will remove every listeners
If off(eventName) will only remove listeners to this specific eventName
If off(eventName, listener) will remove the `listener` to the `eventName`
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eventName
|
string |
nullable
|
see core.api.on for available event names |
listener
|
function |
nullable
|