Class

RezEventProcessor

RezEventProcessor()

Constructor

# new RezEventProcessor()

Processes events in the Rez game engine. Handles browser events (clicks, inputs, submits), custom game events, timer events, and system events. Routes events to appropriate handlers and manages the event lifecycle including system pre/post processing and undo manager integration.

View Source rez_event.js, line 474

Methods

# afterEventProcessing(evt, result) → {*}

Runs the event result through all enabled systems' after_event handlers. Each system can modify the result after the event has been processed.

Parameters:
Name Type Description
evt Event

the original browser event

result *

the result from event processing

View Source rez_event.js, line 585

if any system handler doesn't return a valid result object

Error

the processed result

*

# beforeEventProcessing(evt) → {Event}

Runs the event through all enabled systems' before_event handlers. Each system can modify the event before it gets processed.

Parameters:
Name Type Description
evt Event

the browser event to pre-process

View Source rez_event.js, line 563

if any system handler doesn't return a valid event object

Error

the processed event

Event

# card() → {RezCard}

View Source rez_event.js, line 512

the current card

RezCard

# constructor(game)

Creates a new event processor for the specified game

Parameters:
Name Type Description
game RezGame

the game instance this processor belongs to

View Source rez_event.js, line 484

# decodeEvent(evt) → {Array}

Extracts event name, target, and parameters from an element's dataset attributes

Parameters:
Name Type Description
evt Event

the browser event to decode

View Source rez_event.js, line 694

[eventName, target, params] decoded from the event's dataset

Array

# dispatchResponse(response)

Processes a RezEvent response by executing the actions it specifies: flash messages, scene changes/interludes/resumes, card plays, view renders, and error handling.

Parameters:
Name Type Description
response RezEvent

the event response to process

View Source rez_event.js, line 521

if the response is not a RezEvent instance

Error

# game() → {RezGame}

View Source rez_event.js, line 494

the game instance

RezGame

# getEventHandler(eventName) → {Array}

Finds an event handler by checking card, scene, and game in that order. Returns the first receiver that has a handler for the event.

Parameters:
Name Type Description
eventName string

the name of the event to find a handler for

View Source rez_event.js, line 813

[receiver, handler] pair where receiver is the object that handles the event

Array

# getReceiverEventHandler(receiver, eventname) → {function|null}

Gets an event handler function from a receiver object

Parameters:
Name Type Description
receiver *

the object to check for event handlers

eventname string

the name of the event to find a handler for

View Source rez_event.js, line 796

the event handler function or null if not found

function | null

# handleBrowserClickEvent(evt) → {*}

Handles browser click events by decoding the event data and routing to appropriate handlers. Supports built-in event types (card, switch, interlude, resume) and custom events.

Parameters:
Name Type Description
evt Event

the click event

View Source rez_event.js, line 765

the result of handling the click event

*

# handleBrowserEvent(evt) → {*}

Main event handler that processes browser events. Handles undo recording, system pre/post processing, and routes events to specific handlers based on type.

Parameters:
Name Type Description
evt Event

the browser event to handle

View Source rez_event.js, line 657

the result of processing the event

*

# handleBrowserInputEvent(evt) → {RezEvent}

Handles browser input events by finding the card that contains the input element and calling its input event handler.

Parameters:
Name Type Description
evt Event

the input event

View Source rez_event.js, line 907

if the card container or card ID cannot be found

Error

the result of the card's input event handler

RezEvent

# handleBrowserSubmitEvent(evt) → {RezEvent}

Handles browser form submit events by finding the card that contains the form and calling its event handler named after the form.

Parameters:
Name Type Description
evt Event

the submit event

View Source rez_event.js, line 938

if the form name or card container cannot be found

Error

the result of the card's form event handler

RezEvent

# handleCardEvent(target, params) → {RezEvent}

Handles built-in card events that play a specific card

Parameters:
Name Type Description
target string

ID of the card to play

params object

parameters to pass to the card

View Source rez_event.js, line 847

event that plays the specified card

RezEvent

# handleCustomEvent(eventName, params) → {RezEvent}

Handles custom events by finding and calling the appropriate event handler

Parameters:
Name Type Description
eventName string

the name of the custom event

params object

parameters to pass to the event handler

View Source rez_event.js, line 827

the result of the event handler or an error event

RezEvent

# handleInterludeEvent(target, params) → {RezEvent}

Handles built-in interlude events that interrupt the current scene

Parameters:
Name Type Description
target string

ID of the scene to interlude with

params object

parameters to pass to the scene

View Source rez_event.js, line 877

event that starts an interlude with the specified scene

RezEvent

# handleKeyBindingEvent(evt) → {*}

Handles key binding events by routing them to custom event handlers

Parameters:
Name Type Description
evt CustomEvent

the key binding event with event name details

View Source rez_event.js, line 726

the result of handling the key binding event

*

# handleResumeEvent(params) → {RezEvent}

Handles built-in resume events that return to the previous scene

Parameters:
Name Type Description
params object

parameters to pass to the resumed scene

View Source rez_event.js, line 892

event that resumes the previous scene

RezEvent

# handleSwitchEvent(target, params) → {RezEvent}

Handles built-in switch events that change to a new scene

Parameters:
Name Type Description
target string

ID of the scene to switch to

params object

parameters to pass to the scene

View Source rez_event.js, line 862

event that changes to the specified scene

RezEvent

# handleTimerEvent(evt) → {*}

Handles timer events by routing them to custom event handlers

Parameters:
Name Type Description
evt CustomEvent

the timer event with timer details

View Source rez_event.js, line 709

the result of handling the timer event

*

# handleWindowEvent(evt) → {*}

Handles window events by routing them to custom event handlers with the "window_" prefix (e.g. "wheel" becomes "window_wheel")

Parameters:
Name Type Description
evt CustomEvent

the window event with event name and browser event details

View Source rez_event.js, line 742

the result of handling the window event

*

# isAutoUndoEvent(evt) → {boolean}

Determines if an event should automatically record undo state

Parameters:
Name Type Description
evt Event

the event to check

View Source rez_event.js, line 645

true if this event type should trigger automatic undo recording

boolean

# raiseKeyBindingEvent(event_name) → {*}

Creates and processes a custom key binding event

Parameters:
Name Type Description
event_name string

the name of the key binding event

View Source rez_event.js, line 620

the result of processing the key binding event

*

# raiseTimerEvent(timer) → {*}

Creates and processes a custom timer event

Parameters:
Name Type Description
timer RezTimer

the timer that fired

View Source rez_event.js, line 608

the result of processing the timer event

*

# raiseWindowEvent(eventName, browserEvt) → {*}

Creates and processes a custom window event that wraps a native browser event

Parameters:
Name Type Description
eventName string

the name of the window event (e.g. "wheel", "resize")

browserEvt Event

the native browser event

View Source rez_event.js, line 632

the result of processing the window event

*

# scene() → {RezScene}

View Source rez_event.js, line 503

the current scene

RezScene