A simple Event Emitter for Python
pip install emits
from emits import EventEmitter
emits = EventEmitter()
Register an event listener for the given event_name
which uses the defined callback function to consume the data it receives
def callback(data):
print(data)
emits.on("test add_event_listener", callback)
emits.emit("test add_event_listener", "test data")
Register an event listener for the given event_name
which uses the defined callback function to consume the data it receives only once
Turn off an event listener created by emits.on()
or emits.add_event_listener()