Skip to content

Commit

Permalink
Release v4.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rodgc committed May 11, 2023
1 parent 3963f65 commit d1aaaaf
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 2 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [4.5.1] - 2023-05-11

### Added

- `listeners` Method.
- `listenersAny` Method.
- `listenersAnyOutgoing` Method.
- `off` Method.
- `onAny` Method.
- `onAnyOutgoing` Method.
- `prependAny` Method.
- `prependAnyOutgoing` Method.
- `timeout` Method.
- `volatile` Method.

## [4.5.0] - 2023-05-11

### Added
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-socket-io",
"version": "4.5.0",
"version": "4.5.1",
"description": "Socket.IO module for Angular",
"main": "index.ts",
"scripts": {
Expand Down
53 changes: 53 additions & 0 deletions src/socket-io.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,57 @@ export class WrappedSocket {
fromOneTimeEvent<T>(eventName: string): Promise<T> {
return new Promise<T>(resolve => this.once(eventName, resolve));
}

listeners(eventName: string) {
return this.ioSocket.listeners(eventName);
}

listenersAny() {
return this.ioSocket.listenersAny();
}

listenersAnyOutgoing() {
return this.ioSocket.listenersAnyOutgoing();
}

off(eventName?: string, listener?: Function[]) {
if (!eventName) {
// Remove all listeners for all events
return this.ioSocket.offAny();
}

if (eventName && !listener) {
// Remove all listeners for that event
return this.ioSocket.off(eventName);
}

// Removes the specified listener from the listener array for the event named
return this.ioSocket.off(eventName, listener);
}

onAny(callback: (event: string, ...args: any[]) => void) {
return this.ioSocket.onAny(callback);
}

onAnyOutgoing(callback: (event: string, ...args: any[]) => void) {
return this.ioSocket.onAnyOutgoing(callback);
}

prependAny(callback: (event: string, ...args: any[]) => void) {
return this.ioSocket.prependAny(callback);
}

prependAnyOutgoing(
callback: (event: string | symbol, ...args: any[]) => void
) {
return this.ioSocket.prependAnyOutgoing(callback);
}

timeout(value: number) {
return this.ioSocket.timeout(value);
}

volatile() {
return this.ioSocket.volatile;
}
}

0 comments on commit d1aaaaf

Please sign in to comment.