new Condition()
The condition class monitors a data source and updates it's internal
state depending on clauses that it has been given. When all clauses
are satisfied the then() callback is fired. If conditions were met
but data changed that made them un-met, the else() callback is fired.
- Source:
Methods
- and(clause) → {Condition}
- drop() → {Condition}
- init(dataSource, id, clause)
- start(initialState) → {Condition}
- stop() → {Condition}
and(clause) → {Condition}
Adds a new clause to the condition.
Parameters:
| Name | Type | Description |
|---|---|---|
clause |
Object | The query clause to add to the condition. |
- Source:
Returns:
- Type
- Condition
drop() → {Condition}
Drops the condition and removes it from memory.
- Source:
Returns:
- Type
- Condition
init(dataSource, id, clause)
Class constructor calls this init method.
This allows the constructor to be overridden by other modules because
they can override the init method with their own.
Parameters:
| Name | Type | Description |
|---|---|---|
dataSource |
Collection | View | The condition's data source. |
id |
String | The id to assign to the new Condition. |
clause |
Object | The query clause. |
- Source:
start(initialState) → {Condition}
Starts the condition so that changes to data will call callback
methods according to clauses being met.
Parameters:
| Name | Type | Description |
|---|---|---|
initialState |
* | Initial state of condition. |
- Source:
Returns:
- Type
- Condition
stop() → {Condition}
Stops the condition so that callbacks will no longer fire.
- Source:
Returns:
- Type
- Condition