The Event Continuum
The Pure Functional Flow Model
// Register a single entry point
orderNode.on("create-order", validateOrder);
// The flow is controlled by function returns
function validateOrder(event, context) {
if (!isValidOrder(event.payload)) {
return { success: false, reason: "Invalid order" };
}
// Return the next function to execute
return processOrder;
}
function processOrder(event, context) {
// Process the order
const orderId = createOrderInDatabase(event.payload);
// Store in context
context.orderId = orderId;
// Return the next function
return notifyCustomer;
}
function notifyCustomer(event, context) {
// Send notification using context data
sendOrderConfirmation(context.orderId, event.payload.customer);
// Return final result
return { success: true, orderId: context.orderId };
}How the Continuum Works
Flow Control Through Return Values
Continuing to the Next Step
Completing the Flow with a Result
Dynamic Flow Selection
Shared Context
Complex Flow Patterns
Conditional Branching
Loop Patterns
Error Handling Patterns
Building Complete Workflows
The Power of Pure Functional Flows
Examples of the Event Continuum in Action
Simple Event Handling
Validation Pattern
Request-Response with Direct Return
Ending Flow with Bare Return
Building Reusable Flow Patterns
Parallel Processing
Last updated