events: add function to remove event handlers
Event handlers for remote mgmt API will be registered dynamically, so allow to unregister them. QubesOS/qubes-issues#2622
This commit is contained in:
parent
68c8d219c9
commit
ee967c1e72
@ -115,6 +115,17 @@ class Emitter(object, metaclass=EmitterMeta):
|
|||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
cls.__handlers__[event].add(func)
|
cls.__handlers__[event].add(func)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def remove_handler(cls, event, func):
|
||||||
|
'''Remove event handler from subject's class.
|
||||||
|
|
||||||
|
:param str event: event identificator
|
||||||
|
:param collections.Callable handler: handler callable
|
||||||
|
'''
|
||||||
|
|
||||||
|
# pylint: disable=no-member
|
||||||
|
cls.__handlers__[event].remove(func)
|
||||||
|
|
||||||
|
|
||||||
def _fire_event_in_order(self, order, event, kwargs):
|
def _fire_event_in_order(self, order, event, kwargs):
|
||||||
'''Fire event for classes in given order.
|
'''Fire event for classes in given order.
|
||||||
|
Loading…
Reference in New Issue
Block a user