-
Notifications
You must be signed in to change notification settings - Fork 6
externalEffect
"externalEffect" can be defined in manifest under the "_q" property of any node. That property has a condition part for looking in other collection and make some actions. "externalEffect" will be triggered, if data is sent or if "set" option is defined (as "true" or "permanent") while "flatte.do" function called. Otherwise it will never work.
"externalEffect" property is an array. You can add unlimited copies to any node.
{
node: {
_q:{
// Simple
externalEffect: [{
path: "external/collection/path",
if: {
key: "looking for key in collection",
value: "equal to value of key"
},
save: {
key: "effect field name on save action",
value: "effect field value on save action"
}
delete: {
key: "effect field name on delete action",
value: "effect field value on delete action"
}
}]
}
}
}The path of copy collection. You can use parent nodes' ID's with # (hastag).
Available Options: String.
This is the condition part of externalEffect. Works like;
if (path[key] === value) {...}The looking for collection property name. You can use parent nodes' ID's with # (hastag).
Available Options: String.
The same usage with "saveValue".
On save action, this property will be triggered. Assigns "key = value" inside found collections.
Key name of found collection. You can use parent nodes' ID's with # (hastag).
Available Options: String.
The same usage with "saveValue".
On delete action, this property will be triggered. Assigns "key = value" inside found collections.
Key name of found collection. You can use parent nodes' ID's with # (hastag).
Available Options: String.
The same usage with "saveValue".
This example updates or deletes group names in users collection if name of group is changed or deleted.
{
groups: {
childs: {
groupID: {
_q: {
ID: true,
},
childs: {
groupName: {
_q:{
externalEffect: {
path: "users",
if: {
key: "groups/#groupID/id",
value: "#groupID"
},
save: {
key: "groups/#groupID/groupName",
value: "$"
},
delete: {
key: "groups/#groupID/groupName",
value: null
}
}
}
}
}
}
}
}
}We recommend you to think various complex scenarios and make some tests. Flatte Manifest Builder will help you to create a manifest and you can run your tests, easily
- Flatte is licensed under the MIT License - see the LICENSE.md file for details
Getting Started
Flatte Manifest
Predefined Templates
Usage
Flatte Manifest Builder