@dapex-tech/elite-online-services 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dapex-tech/elite-online-services",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "private": false,
@@ -20,6 +20,8 @@ export declare class SocketService {
20
20
  offConnected(cb?: (data: any) => void): void;
21
21
  onDisconnected(cb: (data: any) => void): void;
22
22
  offDisconnected(cb?: (data: any) => void): void;
23
+ onDisconnect(cb: (data: any) => void): void;
24
+ offDisconnect(cb?: (data: any) => void): void;
23
25
  onDriverStatusUpdate(cb: (data: DriverStatus) => void): void;
24
26
  offDriverStatusUpdate(cb?: (data: DriverStatus) => void): void;
25
27
  onTripUpdate(cb: (data: any) => void): void;
package/socketService.js CHANGED
@@ -97,6 +97,17 @@ class SocketService {
97
97
  this.socket.removeAllListeners('disconnected');
98
98
  }
99
99
  }
100
+ onDisconnect(cb) {
101
+ this.socket.on('disconnect', cb);
102
+ }
103
+ offDisconnect(cb) {
104
+ if (cb) {
105
+ this.socket.off('disconnect', cb);
106
+ }
107
+ else {
108
+ this.socket.removeAllListeners('disconnected');
109
+ }
110
+ }
100
111
  onDriverStatusUpdate(cb) {
101
112
  this.socket.on('driverStatusUpdate', cb);
102
113
  }