Erweiterungen
This commit is contained in:
1 parent
41d086e13e
commit
7015d83fd1
20 files changed
+182
-158
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
typedef EventHandler<T> = void Function(T args);
|
||||
|
||||
class _MapEntry {
|
||||
@@ -59,13 +61,18 @@ class MessageService {
|
||||
}
|
||||
}
|
||||
|
||||
publish<T>(String topic, {T? arguments}) {
|
||||
publish<T>(String topic, {T? arguments}) async {
|
||||
Completer<void> completer = Completer();
|
||||
var entries = _callbackMaps[topic];
|
||||
|
||||
if (entries != null) {
|
||||
for (var entry in entries) {
|
||||
entry.handler(arguments);
|
||||
}
|
||||
|
||||
completer.complete();
|
||||
}
|
||||
|
||||
await completer.future;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user