airfone-client-js
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -14,2 +14,7 @@ export declare type StatusEvent = 'connect' | 'disconnect' | 'online' | 'offline' | 'error'; | ||
export declare type ConnectState = 0 | 1 | 2 | 3; | ||
declare class Payload { | ||
readonly from: any; | ||
readonly time: number; | ||
readonly payload: any; | ||
} | ||
export default class AirfoneClient { | ||
@@ -27,4 +32,5 @@ readonly options: ClientOptions; | ||
broadcast(payload: any): void; | ||
on(event: StatusEvent | MessageEvent | String, handle: Function): AirfoneClient; | ||
on(event: StatusEvent | MessageEvent | String, handle: (payload: Payload) => {}): AirfoneClient; | ||
} | ||
export declare function getClient(options: ClientOptions): AirfoneClient; | ||
export {}; |
@@ -44,12 +44,12 @@ import { io } from 'socket.io-client'; | ||
let { payload = {}, from, time } = data; | ||
(_a = ReceiveFunctionMap.get(payload._uid)) === null || _a === void 0 ? void 0 : _a.call(this, Object.assign(Object.assign({}, payload), { from, time })); | ||
(_b = this.events.get('message')) === null || _b === void 0 ? void 0 : _b.call(this, Object.assign(Object.assign({}, payload), { from, time })); | ||
}).on(`${room}/${role}`, (payload) => { | ||
(_a = ReceiveFunctionMap.get(payload._uid)) === null || _a === void 0 ? void 0 : _a.call(this, { payload, from, time }); | ||
(_b = this.events.get('message')) === null || _b === void 0 ? void 0 : _b.call(this, { payload, from, time }); | ||
}).on(`${room}/${role}`, (data) => { | ||
var _a; | ||
let { data, event = 'role', time, from } = payload; // from 来自谁发的角色通知 | ||
(_a = this.events.get(event)) === null || _a === void 0 ? void 0 : _a.call(this, Object.assign(Object.assign({}, data), { time, from })); | ||
}).on(`${room}`, (payload) => { | ||
let { payload = {}, event = 'role', time, from } = data; // from 来自谁发的角色通知 | ||
(_a = this.events.get(event)) === null || _a === void 0 ? void 0 : _a.call(this, { payload, from, time }); | ||
}).on(`${room}`, (data) => { | ||
var _a; | ||
let { data, event = 'group', time, from } = payload; // from 来自谁发的群公告 | ||
(_a = this.events.get(event)) === null || _a === void 0 ? void 0 : _a.call(this, Object.assign(Object.assign({}, data), { time, from })); | ||
let { payload = {}, event = 'group', time, from } = data; // from 来自谁发的群公告 | ||
(_a = this.events.get(event)) === null || _a === void 0 ? void 0 : _a.call(this, { payload, from, time }); | ||
}).on('error', (error) => { | ||
@@ -56,0 +56,0 @@ var _a; |
{ | ||
"name": "airfone-client-js", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index", |
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
6657
156