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 568

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 687

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 665

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

Error

the processed event

Event

# card() → {RezCard}

View Source rez_event.js, line 606

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 578

# 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 796

[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 615

if the response is not a RezEvent instance

Error

# game() → {RezGame}

View Source rez_event.js, line 588

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 915

[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 898

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 867

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 759

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 1015

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 1046

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 955

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 935

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 985

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 828

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 1000

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 970

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 811

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 844

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 747

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 722

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 710

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 734

the result of processing the window event

*

# scene() → {RezScene}

View Source rez_event.js, line 597

the current scene

RezScene