summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/feature_async-events-api1
-rw-r--r--src/leap/common/events/__init__.py13
2 files changed, 14 insertions, 0 deletions
diff --git a/changes/feature_async-events-api b/changes/feature_async-events-api
new file mode 100644
index 0000000..d4979bd
--- /dev/null
+++ b/changes/feature_async-events-api
@@ -0,0 +1 @@
+- Expose async methods for events. Closes: #7274
diff --git a/src/leap/common/events/__init__.py b/src/leap/common/events/__init__.py
index 87ed8ae..18d0ac8 100644
--- a/src/leap/common/events/__init__.py
+++ b/src/leap/common/events/__init__.py
@@ -39,6 +39,7 @@ import logging
import argparse
from leap.common.events import client
+from leap.common.events import txclient
from leap.common.events import server
from leap.common.events.flags import set_events_enabled
@@ -80,6 +81,10 @@ def register(event, callback, uid=None, replace=False):
return client.register(event, callback, uid, replace)
+def register_async(event, callback, uid=None, replace=False):
+ return txclient.register(event, callback, uid, replace)
+
+
def unregister(event, uid=None):
"""
Unregister callbacks for an event.
@@ -95,6 +100,10 @@ def unregister(event, uid=None):
return client.unregister(event, uid)
+def unregister_async(event, uid=None):
+ return txclient.unregister(event, uid)
+
+
def emit(event, *content):
"""
Send an event.
@@ -107,6 +116,10 @@ def emit(event, *content):
return client.emit(event, *content)
+def emit_async(event, *content):
+ return txclient.emit(event, *content)
+
+
if __name__ == "__main__":
def _echo(event, *content):