From aca544126429a77c105626b55ac64f485e72733b Mon Sep 17 00:00:00 2001 From: Altynbek Aidarbekov <48729942+altynbek132@users.noreply.github.com> Date: Thu, 15 Jun 2023 16:06:03 +0600 Subject: [PATCH] Socket.on... returns disposer function --- lib/src/darty.dart | 52 +++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/src/darty.dart b/lib/src/darty.dart index df89e3e..ed7a3cc 100644 --- a/lib/src/darty.dart +++ b/lib/src/darty.dart @@ -7,56 +7,56 @@ import 'package:socket_io_common/src/util/event_emitter.dart'; /// Default event listeners for dart way API. extension DartySocket on Socket { - void onConnect(EventHandler handler) { - on('connect', handler); + void Function() onConnect(EventHandler handler) { + return on('connect', handler); } - void onConnectError(EventHandler handler) { - on('connect_error', handler); + void Function() onConnectError(EventHandler handler) { + return on('connect_error', handler); } - void onConnectTimeout(EventHandler handler) { - on('connect_timeout', handler); + void Function() onConnectTimeout(EventHandler handler) { + return on('connect_timeout', handler); } - void onConnecting(EventHandler handler) { - on('connecting', handler); + void Function() onConnecting(EventHandler handler) { + return on('connecting', handler); } - void onDisconnect(EventHandler handler) { - on('disconnect', handler); + void Function() onDisconnect(EventHandler handler) { + return on('disconnect', handler); } - void onError(EventHandler handler) { - this.io.on('error', handler); + void Function() onError(EventHandler handler) { + return this.io.on('error', handler); } - void onReconnect(EventHandler handler) { - this.io.on('reconnect', handler); + void Function() onReconnect(EventHandler handler) { + return this.io.on('reconnect', handler); } - void onReconnectAttempt(EventHandler handler) { - this.io.on('reconnect_attempt', handler); + void Function() onReconnectAttempt(EventHandler handler) { + return this.io.on('reconnect_attempt', handler); } - void onReconnectFailed(EventHandler handler) { - this.io.on('reconnect_failed', handler); + void Function() onReconnectFailed(EventHandler handler) { + return this.io.on('reconnect_failed', handler); } - void onReconnectError(EventHandler handler) { - this.io.on('reconnect_error', handler); + void Function() onReconnectError(EventHandler handler) { + return this.io.on('reconnect_error', handler); } - void onReconnecting(EventHandler handler) { - on('reconnecting', handler); + void Function() onReconnecting(EventHandler handler) { + return on('reconnecting', handler); } - void onPing(EventHandler handler) { - this.io.on('ping', handler); + void Function() onPing(EventHandler handler) { + return this.io.on('ping', handler); } - void onPong(EventHandler handler) { - on('pong', handler); + void Function() onPong(EventHandler handler) { + return on('pong', handler); } }