Skip to content

FJsMacros.EventAndContext ​

com.jsmacrosce.jsmacros.core.library.impl.FJsMacros.EventAndContext

Pairs an event received by waitForEvent with its event container.

js
const next = JsMacros.waitForEvent("Tick");  
try {
  Chat.log(next.event.getEventName());  
} finally {
  next.context.releaseLock();  
}

Release the context lock promptly after processing when the returned event is held; the result is not necessarily currently locked.

Type Parameters ​

  • E: paired event type

Nested type declared in JsMacros; not a separate global library.

Constructors ​

new FJsMacros.EventAndContext ​

new FJsMacros.EventAndContext(E extends BaseEvent event, EventContainer<?> context)#
Stores the supplied event and container references without dispatching or changing lock state.

Parameters:

  • event: event to pair
  • context: paired event container; supply a non-null reference for toString()

Fields ​

context ​

context: EventContainer<?>read-only#
The event container paired with event; release its lock promptly when processing a held event.

event ​

event: E extends BaseEventread-only#
The event reference paired with context; it is not copied or frozen.

Methods ​

toString ​

toString(): String#
Formats both stored references as EventAndContext:{"event": %s, "context": %s} using their toString() results; this is diagnostic text, not JSON or a snapshot.
Returns: diagnostic string containing the event and container representations