[core] make bumblebee more reactive
- set default delay to 0 - split input reading into 2 threads - get rid of polling
This commit is contained in:
parent
868502d62e
commit
9f89e3a657
3 changed files with 45 additions and 40 deletions
|
@ -8,6 +8,13 @@ def register(event, callback, *args, **kwargs):
|
|||
|
||||
__callbacks.setdefault(event, []).append(cb)
|
||||
|
||||
def register_exclusive(event, callback, *args, **kwargs):
|
||||
cb = callback
|
||||
if args or kwargs:
|
||||
cb = lambda: callback(*args, **kwargs)
|
||||
|
||||
__callbacks[event] = [cb]
|
||||
|
||||
def unregister(event):
|
||||
if event in __callbacks:
|
||||
del __callbacks[event]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue