Files
osiris/examples/engine/02_event.rhai
Timur Gordon 87c556df7a wip
2025-10-29 16:52:33 +01:00

45 lines
1.2 KiB
Plaintext

// Example 2: Creating and working with Events
print("=== Event Example ===\n");
// Get a context to work with
print("1. Getting context...");
let ctx = get_context(["alice", "charlie"]);
print(" ✓ Context created: " + ctx.context_id());
// Create events with builder pattern
print("\n2. Creating events...");
let standup = event("calendar", "Daily Standup")
.description("Quick sync on progress and blockers");
print(" ✓ Created daily standup event");
let review = event("calendar", "Sprint Review")
.description("Demo completed features to stakeholders");
print(" ✓ Created sprint review event");
let workshop = event("calendar", "OSIRIS Workshop")
.description("Deep dive into OSIRIS architecture and Rhai integration");
print(" ✓ Created workshop event");
// Save events to context
print("\n3. Saving events to context...");
ctx.save(standup);
print(" ✓ Saved standup event");
ctx.save(review);
print(" ✓ Saved review event");
ctx.save(workshop);
print(" ✓ Saved workshop event");
// List all events in context
print("\n4. Listing events in context...");
let event_ids = ctx.list("calendar");
print(" ✓ Found " + event_ids.len() + " events in context");
print("\n=== Event Example Complete ===");