octoprint.events#
CommandTrigger(printer)
#
Bases: GenericEventListener
eventCallback(event, payload)
#
Event callback, iterates over all subscribed commands for the given event, processes the command string and then executes the command via the abstract executeCommand method.
EventManager()
#
Handles receiving events and dispatching them to subscribers
fire(event, payload = None)
#
Fire an event to anyone subscribed to it
Any object can generate an event and any object can subscribe to the event's name as a string (arbitrary, but case sensitive) and any extra payload data that may pertain to the event.
Callbacks must implement the signature "callback(event, payload)", with "event" being the event's name and payload being a payload object specific to the event.
subscribe(event, callback)
#
Subscribe a listener to an event -- pass in the event name (as a string) and the callback object
unsubscribe(event, callback)
#
Unsubscribe a listener from an event -- pass in the event name (as string) and the callback object
GenericEventListener()
#
The GenericEventListener can be subclassed to easily create custom event listeners.
eventCallback(event, payload)
#
Actual event callback called with name of event and optional payload. Not implemented here, override in child classes.
subscribe(events)
#
Subscribes the eventCallback method for all events in the given list.
unsubscribe(events)
#
Unsubscribes the eventCallback method for all events in the given list