Socket
Socket
Sign inDemoInstall

airfone-client-js

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

airfone-client-js - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

8

lib/index.d.ts

@@ -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 {};

16

lib/index.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc