Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket.on... returns disposer function #334

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions lib/src/darty.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down