wip
This commit is contained in:
44
examples/engine/02_event.rhai
Normal file
44
examples/engine/02_event.rhai
Normal file
@@ -0,0 +1,44 @@
|
||||
// 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 ===");
|
||||
Reference in New Issue
Block a user