Socket
Socket
Sign inDemoInstall

airfone-client-js

Package Overview
Dependencies
13
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.15 to 0.0.16

17

lib/index.d.ts

@@ -22,2 +22,3 @@ export declare type StatusEvent = 'connect' | 'disconnect' | 'online' | 'offline' | 'error';

}
export declare type Handle = (payload: Payload) => {};
export default class AirfoneClient {

@@ -32,10 +33,20 @@ readonly options: ClientOptions;

disconnect(): void;
chat(id: String, payload: any, receive?: Function): void;
chat(id: String, payload: any, receive?: Handle): void;
notice(role: String, payload: any): void;
broadcast(payload: any): void;
broadcasts(payload: any): void;
onIf(bool: boolean, events: StatusEvent | MessageEvent | String | Array<StatusEvent | MessageEvent | String>, handle?: (payload: Payload) => void): this;
on(events: StatusEvent | MessageEvent | String | Array<StatusEvent | MessageEvent | String>, handle?: (payload: Payload) => void): this;
onIf(bool: boolean, events: StatusEvent, handle: Handle): this;
onIf(bool: boolean, events: MessageEvent, handle: Handle): this;
onIf(bool: boolean, events: String, handle: Handle): this;
onIf(bool: boolean, events: Array<StatusEvent>, handle: Handle): this;
onIf(bool: boolean, events: Array<MessageEvent>, handle: Handle): this;
onIf(bool: boolean, events: Array<String>, handle: Handle): this;
on(events: StatusEvent, handle: Handle): this;
on(events: MessageEvent, handle: Handle): this;
on(events: String, handle: Handle): this;
on(events: Array<StatusEvent>, handle: Handle): this;
on(events: Array<MessageEvent>, handle: Handle): this;
on(events: Array<String>, handle: Handle): this;
}
export declare function getClient(options: ClientOptions): AirfoneClient;
export {};

5

lib/index.js

@@ -144,4 +144,5 @@ import { io } from 'socket.io-client';

}
onIf(bool, events, handle = (payload) => { }) {
onIf(bool, events, handle) {
if (bool) {
// @ts-ignore
return this.on(events, handle);

@@ -151,3 +152,3 @@ }

}
on(events, handle = (payload) => { }) {
on(events, handle) {
if (this.state != 0) {

@@ -154,0 +155,0 @@ throw new Error('监听必须在调用connect方法之前添加');

{
"name": "airfone-client-js",
"version": "0.0.15",
"version": "0.0.16",
"description": "",

@@ -5,0 +5,0 @@ "main": "./lib/index",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc