Event

Description

An opaque awaitable type, specifically used in coroutines, representing an event owned by a specific object, that can be 'awaited', or listened to.

Event e = current.event(“OnEntry”);
await e;
await e; // awaiting the same Event object a second time will await the event a second time. 
// The listening is initiated when the await statement executes, not when 
// the event object is created. In other words, an instance of an Event object is
// a reference to an object’s event that may fire multiple times, not a single 
// execution of an object’s event.

await current.event(“OnExit”);
await Event.evaluation(current.labels[“MyCode”]);
Event evaluationEvent = Event.evaluation(current.labels[“MyCode”]);
while (true) {
	await evaluationEvent;
	…
}

An event represents a generic reference to a specific object's OnEntry, OnExit, etc., event. It is not a reference to a single execution of an object's event. This means you can await the same Event multiple times, and each await may be resumed on different executions of the object's event. In other words, the listening mechanism is initiated when the await statement executes, not when the Event object is created.

Static Methods

evaluation Returns an Event object representing the evaluation of a node in the tree.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

Event.evaluation()

static Event evaluation( treenode node )

Parameters

node The node whose evaluation you want to listen for.

Returns

Event The resulting Event.

Description

Returns an Event object representing the evaluation of a node in the tree.

await Event.evaluation(current.labels["MyCode"]);