Provides trigger functionality methods.
- Source:
Methods
- (static) addLinkIO(id, ioData)
- (static) addTrigger(id, type, phase, method) → {boolean}
- (static) ignoreTriggers(val) → {*}
- (static) processTrigger(operation, type, phase, oldDoc, newDoc) → {boolean}
- (static) removeLinkIO(id) → {boolean}
- (static) removeTrigger(id, type, phase) → {boolean}
- (static) willTrigger(type, phase) → {Boolean}
(static) addLinkIO(id, ioData)
Generates triggers that fire in the after phase for all CRUD ops
that automatically transform data back and forth and keep both
import and export collections in sync with each other.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
String | The unique id for this link IO. |
ioData |
Object | The settings for the link IO. |
- Source:
(static) addTrigger(id, type, phase, method) → {boolean}
Add a trigger by id, type and phase.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
String | The id of the trigger. This must be unique to the type and phase of the trigger. Only one trigger may be added with this id per type and phase. |
type |
Constants | The type of operation to apply the trigger to. See Mixin.Constants for constants to use. |
phase |
Constants | The phase of an operation to fire the trigger on. See Mixin.Constants for constants to use. |
method |
Triggers.addTriggerCallback | The method to call when the trigger is fired. |
- Source:
Returns:
True if the trigger was added successfully, false if not.
- Type
- boolean
(static) ignoreTriggers(val) → {*}
Tells the current instance to fire or ignore all triggers whether they
are enabled or not.
Parameters:
| Name | Type | Description |
|---|---|---|
val |
Boolean | Set to true to ignore triggers or false to not ignore them. |
- Source:
Returns:
- Type
- *
(static) processTrigger(operation, type, phase, oldDoc, newDoc) → {boolean}
Processes trigger actions based on the operation, type and phase.
Parameters:
| Name | Type | Description |
|---|---|---|
operation |
Object | Operation data to pass to the trigger. |
type |
Number | The type of operation. See Mixin.Constants for constants to use. |
phase |
Number | The phase of the operation. See Mixin.Constants for constants to use. |
oldDoc |
Object | The document snapshot before operations are carried out against the data. |
newDoc |
Object | The document snapshot after operations are carried out against the data. |
- Source:
Returns:
- Type
- boolean
(static) removeLinkIO(id) → {boolean}
Removes a previously added link IO via it's ID.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
String | The id of the link IO to remove. |
- Source:
Returns:
True if successful, false if the link IO
was not found.
- Type
- boolean
(static) removeTrigger(id, type, phase) → {boolean}
Removes a trigger by id, type and phase.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
String | The id of the trigger to remove. |
type |
Number | The type of operation to remove the trigger from. See Mixin.Constants for constants to use. |
phase |
Number | The phase of the operation to remove the trigger from. See Mixin.Constants for constants to use. |
- Source:
Returns:
True if removed successfully, false if not.
- Type
- boolean
(static) willTrigger(type, phase) → {Boolean}
Checks if a trigger will fire based on the type and phase provided.
Parameters:
| Name | Type | Description |
|---|---|---|
type |
Number | The type of operation. See Mixin.Constants for constants to use. |
phase |
Number | The phase of the operation. See Mixin.Constants for constants to use. |
- Source:
Returns:
True if the trigger will fire, false otherwise.
- Type
- Boolean
Type Definitions
addTriggerCallback(operation, oldDoc, newDoc)
When called in a before phase the newDoc object can be directly altered
to modify the data in it before the operation is carried out.
Parameters:
| Name | Type | Description |
|---|---|---|
operation |
Object | The details about the operation. |
oldDoc |
Object | The document before the operation. |
newDoc |
Object | The document after the operation. |
- Source: