@chijs/client
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -12,5 +12,7 @@ import type { Socket } from 'socket.io-client'; | ||
misc: import("@chijs/core").WithoutPrefix<import("@chijs/core").WithPrefix<import("@chijs/core").IServerAPI, "$s:">, "$s:misc:">; | ||
private socketListener; | ||
constructor(socket: Socket); | ||
dispose(reason: unknown): void; | ||
} | ||
export * from '@chijs/core'; | ||
export * from 'socket.io-client'; |
@@ -10,6 +10,8 @@ import { RpcEndpoint, createRpcWrapper, RPC } from '@chijs/core'; | ||
misc; | ||
socketListener; | ||
constructor(socket) { | ||
this.socket = socket; | ||
this.endpoint = new RpcEndpoint(RPC.client(socket.id), (msg) => socket.emit('rpc', msg)); | ||
this.socket.on('rpc', (msg) => this.endpoint.recv(msg)); | ||
this.socketListener = (msg) => this.endpoint.recv(msg); | ||
this.socket.on('rpc', this.socketListener); | ||
this.server = this.endpoint.getHandle(RPC.server()); | ||
@@ -21,2 +23,6 @@ this.service = createRpcWrapper(this.server, '$s:service:'); | ||
} | ||
dispose(reason) { | ||
this.socket.off('rpc', this.socketListener); | ||
this.endpoint.dispose(reason); | ||
} | ||
} | ||
@@ -23,0 +29,0 @@ export * from '@chijs/core'; |
{ | ||
"name": "@chijs/client", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "license": "AGPL-3.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4181
45