メインコンテンツまでスキップ

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>.


Callbacks

custom

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

ParameterTypeDescription
messagestringCustom message payload.

debug

This callback is used when a debug event is emitted.

ParameterTypeDescription
xpFunctionstringThe function firing this event.
messagestringThe message of the event.

error

This callback is used when an error event is emitted.

ParameterTypeDescription
xpFunctionstringThe function firing this event.
messagestringThe message of the event.

info

This callback is used when an info event is emitted.

ParameterTypeDescription
xpFunctionstringThe function firing this event.
messagestringThe message of the event.

levelDown

This callback is used when a user loses a level.

ParameterTypeDescription
dataUserResultThe user data.
lostRolesstring[]The lost roles of user

levelUp

This callback is used when a user levels up.

ParameterTypeDescription
dataUserResultThe user data.
newRolesstring[]The new roles of user

warn

This callback is used when a warn event is emitted.

ParameterTypeDescription
xpFunctionstringThe function firing this event.
messagestringThe message of the event.