A minimalist event emitter for C++14
Event emitters are handy for evented programming, Node.js has a
nice one
.
This one is similar, but with a few less features. This emitter
allows you to emit and receive arbitrary/variadic paramaters of equal
type.
#include "events.h"
int main() {
EventEmitter ee;
ee.on("hello", [](string name, int num) {
// ...do something with the values.
});
ee.emit("hello", "beautiful", 100);
}
Listen for an event multiple times.
Listen for an event only once.
Emit data for a particular event.
Remove listener for a particular event.
Remove all listeners on the emitter.
Find out how many listeners had been added to an emitter.
How many listeners an event emitter should have before considering that there is a memory leak.