apptivity
An activity workflow player that sequentially runs action, condition, fork, merge and prompt input actions.
This library has the following features.
-
Convenient and rich definition API to define and configure Workflow activities and actions. It helps developers to focus on overall activity logic before detailing them with their implementations.
-
Flexible definition API allows splitting of Worfklow activity definition with their implementation, keeping files and directories of Workflow modules organized.
-
Workflow activities and actions are more predictable as they each publish an immutable state object containing unique state name, action name, request data, and response data per completed run of Activity action.
-
Activity action supports asynchronous runs by supplying a
callback
function that returns Promise Object when defining Action implementations using handler(callback:Function) or guard(callback:Function) methods. -
Workflows' internal Finite State Machine can be exported into any custom JSON schema using workflow.trasform(workflowName:String).
Installation
This little library is packaged by npm. Source can be found in github repository
npm install apptivity --save
Usage
Create a Workflow activity and chain-configure actions with definition API.
var workflow = ; workflow // create action // your last action ;
Run the newly created Workflow activity and monitor state changes.
// register event listener // run the workflow ;
Listen to other running Workflow activity sessions' state-change
event.
var stopListening = workflow;// I change my mind, I don't have to listen to "createUser" workflow's "state-change" events;
Note: You can subscribe to a workflow event anytime even if the workflow does not exist.
Export the workflow into Finite State Machine configuration to create an instance of javascript-state-machine.
var StateMachine = ; var createUserStateMachine = StateMachine;
Documentation
API Documentation is now hosted in a separate page. You can explore it from Apptivity Project page.