Skip to content
On this page

XpEventCallback

This documentation defines callback functions that can be used to handle different XP events. These callbacks are invoked for logging and level-related events during simply-xp execution.

All callbacks are optional and may return either void or Promise<void>.


This callback can be used by custom emitters that want to reuse the shared callback object shape.

Parameter Type Description
message string Custom message payload.

This callback is used when a debug event is emitted.

Parameter Type Description
xpFunction string The function firing this event.
message string The message of the event.

This callback is used when an error event is emitted.

Parameter Type Description
xpFunction string The function firing this event.
message string The message of the event.

This callback is used when an info event is emitted.

Parameter Type Description
xpFunction string The function firing this event.
message string The message of the event.

This callback is used when a user loses a level.

Parameter Type Description
data UserResult The user data.
lostRoles [string] The lost roles of user

This callback is used when a user levels up.

Parameter Type Description
data UserResult The user data.
newRoles [string] The new roles of user

This callback is used when a warn event is emitted.

Parameter Type Description
xpFunction string The function firing this event.
message string The message of the event.