Event
INFO
📙 What you'll learn
Trigger an event
codeNotSent
, verificationFailed
, failedLogout
, and many more. These events that can be triggered by the emitter's 'emit()' method. This method causes the event to be pushed using the data that the developer has provided.emit()
method can be called with a list of parameters. These parameters state the event's action and the passed data along with it as below:
salla.trigger_name.event.action_name()
:
Listening to the event
salla.event.{modul name}.{action name}()
, where the trigger, action, can be auth
during the login, and the result of that action is verified
.INFO
auth
, cart
, etc.onVerified
in the auth
module.
one
time listener for the event along with an anonymized function to perform the needed action based on the event result.
onlyWhen
event triggers a callback only once when the event occurs. If the event has already been emitted, it runs immediately; otherwise, it waits for the event. This ensures responsive handling of past and future events.