Make events.remove_listener remove empty lists as well
This commit is contained in:
parent
0d5839ac6a
commit
95967b8633
@ -14,6 +14,8 @@ def remove_listener(event, callback, priority = 5):
|
|||||||
if event in EVENT_CALLBACKS and (priority, callback) in EVENT_CALLBACKS[event]:
|
if event in EVENT_CALLBACKS and (priority, callback) in EVENT_CALLBACKS[event]:
|
||||||
EVENT_CALLBACKS[event].remove((priority, callback))
|
EVENT_CALLBACKS[event].remove((priority, callback))
|
||||||
|
|
||||||
|
if event in EVENT_CALLBACKS and not EVENT_CALLBACKS[event]:
|
||||||
|
del EVENT_CALLBACKS[event]
|
||||||
|
|
||||||
class Event:
|
class Event:
|
||||||
def __init__(self, name, data):
|
def __init__(self, name, data):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user