-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event based behavior(actions) framework #26
Comments
Terminology
Key Points
Defintion: when([EVENT_NAME]).then(function(event) {
[EXECUTION_BODY]
} The execution body support below:
|
One .js file define one Responsible, one Responsible can define one or more event based behavior functions. The .js file structure should be like below: {
"name": "xxx", // The name of Responsible
"behaviors": [{
"event": "xxx", // The event name
"behavior" = function() {...} // The behavior codes
}, {
...
}]
} The behavior is a javascript function, you can invoke any action and non-event-based behavior: {
"event": ${event_name},
"behavior": function(event) {
createPipe().then("xxx").then("xxx");
}
} The above "xxx" is action name or behavior name, if action name and behavior name is duplicated, you can add prefix: action:xxx or behavior:xxx. Create behavior with branch: function(event) {
var result = createPipe().with(event).then("xxx").execute();
if (result.t === 'test') {
createPipe().with(result).then("xxx").execute();
} else {
createPipe().with("xxx").then("xxx");
}
} We also can using for/while in the function: function(event) {
var result = createPipe().with(event).then("xxx").execute();
for (var i = 0; i < result.count; i++) {
createPipe().with(i).then("xxx").execute();
}
} |
There are two phases to deliver the feature:
|
No description provided.
The text was updated successfully, but these errors were encountered: