summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-09-14 23:06:29 -0400
committerKali Kaneko <kali@leap.se>2015-09-15 12:40:02 -0400
commit9d0900de85d07ec5b7926708c51136810b337158 (patch)
tree74bdeaaf7dc4deddfd2550e2c4cabafceb016a4c
parent0748be7aa4a7031adf55cccf3d106f0ca8e64f07 (diff)
[feat] expose async events in api
to make simpler the import of the tx client - Related: #7274
-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):