Binds a one-time event handler to an operating system event
⚠️ NOTE: Requires an active event loop to process events
Registers a one-time event handler that will be automatically removed after being called once.
The name of the event to listen for
The function to call when the event occurs
Optional function to filter events based on their arguments
A function that can be called to remove the event handler
events.once('player_join', (playerName) => console.log(`First player to join: ${playerName}`)); Copy
events.once('player_join', (playerName) => console.log(`First player to join: ${playerName}`));
Binds a one-time event handler to an operating system event
⚠️ NOTE: Requires an active event loop to process events
See