1.0.25 • Published 2 years ago
@shagos/rovents v1.0.25
Rovents
npm i @shagos/rovents
shared/events/PlayerDied
class PlayerDied extends Event {
constructor(public player: Player) {}
}
Calling Event
EventHandler.callEvent(PlayerDied, new PlayerDied(SomePlayer));
Receiving Event (Static)
Static events only run once on each method they are attached to, and cannot use this
keyword
class PlayerListeners {
@EventHandler.Static(PlayerDied)
onPlayerDied(event: PlayerDied) {
print(`${event.Player.Name} died`);
}
}
Receiving Event (Instanced)
Classes that you want to be instanced based will require you to add a method call to the constructor And an optional one to a destructor if you use one.
@EventHandler.Instanced()
class PlayerListeners {
someRandomValue: 321;
constructor() {
EventHandler.newInstance(this);
}
@EventHandler.Instance(PlayerDied)
onPlayerDied(event: PlayerDied) {
print(`${event.Player.Name} Died`);
this.someRandomValue += 1;
}
// Optional destructor method call
// You should call this if your classes are being destroyed
destroy() {
EventHandler.instanceDestroyed();
}
}
1.0.19
2 years ago
1.0.18
2 years ago
1.0.17
2 years ago
1.0.16
2 years ago
1.0.22
2 years ago
1.0.21
2 years ago
1.0.20
2 years ago
1.0.25
2 years ago
1.0.24
2 years ago
1.0.23
2 years ago
1.0.15
2 years ago
1.0.14
2 years ago
1.0.13
2 years ago
1.0.12
2 years ago
1.0.11
2 years ago
1.0.10
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago