Socket
Socket
Sign inDemoInstall

@types/phoenix

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

@types/phoenix - npm Package Compare versions

Comparing version 0.0.5 to 1.4.0

115

phoenix/index.d.ts

@@ -1,21 +0,25 @@

// Type definitions for phoenix
// Type definitions for phoenix 1.4
// Project: https://github.com/phoenixframework/phoenix
// Definitions by: Mirosław Ciastek <https://github.com/mciastek>, John Goff <https://github.com/John-Goff>
// Definitions by: Mirosław Ciastek <https://github.com/mciastek>, John Goff <https://github.com/John-Goff>, Po Chen <https://github.com/princemaple>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
declare module "phoenix" {
declare module 'phoenix' {
class Push {
constructor(channel: Channel, event: string, payload: any, timeout: number);
constructor(
channel: Channel,
event: string,
payload: object,
timeout: number,
);
send(): void;
resend(timeout: number): void;
send(): void;
receive(status: string, callback: (response?: any) => void): Push;
receive(status: string, callback: (response?: any) => any): this;
}
export class Channel {
constructor(topic: string, params?: Object, socket?: Socket);
class Channel {
constructor(topic: string, params?: object | Function, socket?: Socket);
rejoinUntilConnected(): void;
join(timeout?: number): Push;

@@ -31,9 +35,21 @@ leave(timeout?: number): Push;

canPush(): boolean;
push(event: string, payload: object, timeout?: number): Push;
}
push(event: string, payload: Object, timeout?: number): Push;
type ConnectionState = 'connecting' | 'open' | 'closing' | 'closed';
interface SocketConnectOption {
params: object | Function;
transport: any;
timeout: number;
heartbeatIntervalMs: number;
reconnectAfterMs: number;
longpollernumber: number;
encode: (payload: object, callback: Function) => any;
decode: (payload: string, callback: Function) => any;
logger: (kind: string, message: string, data: any) => void;
}
export class Socket {
constructor(endPoint: string, opts?: Object);
class Socket {
constructor(endPoint: string, opts?: Partial<SocketConnectOption>);

@@ -43,7 +59,14 @@ protocol(): string;

disconnect(callback?: Function, code?: string, reason?: any): void;
connect(params?: any): void;
disconnect(callback?: Function, code?: number, reason?: string): void;
connectionState(): ConnectionState;
isConnected(): boolean;
log(kind: string, msg: string, data: any): void;
remove(channel: Channel): void;
channel(topic: string, chanParams?: object): Channel;
push(data: object): void;
log(kind: string, message: string, data: object): void;
hasLogger(): boolean;
onOpen(callback: Function): void;

@@ -54,25 +77,6 @@ onClose(callback: Function): void;

onConnOpen(): void;
onConnClose(event: any): void;
onConnError(error: any): void;
triggerChanError(): void;
connectionState(): string;
isConnected(): boolean;
remove(channel: Channel): void;
channel(topic: string, chanParams?: Object): Channel;
push(data: any): void;
makeRef(): string;
sendHeartbeat(): void;
flushSendBuffer(): void;
onConnMessage(rawMessage: any): void;
}
export class LongPoll {
class LongPoll {
constructor(endPoint: string);

@@ -92,4 +96,6 @@

export class Ajax {
request(
class Ajax {
static states: {[state: string]: number};
static request(
method: string,

@@ -104,3 +110,3 @@ endPoint: string,

xdomainRequest(
static xdomainRequest(
req: any,

@@ -115,3 +121,3 @@ method: string,

xhrRequest(
static xhrRequest(
req: any,

@@ -127,13 +133,19 @@ method: string,

parseJSON(resp: string): JSON;
serialize(obj: any, parentKey: string): string;
appendParams(url: string, params: any): string;
static parseJSON(resp: string): JSON;
static serialize(obj: any, parentKey: string): string;
static appendParams(url: string, params: any): string;
}
export class Presence {
constructor(channel: Channel, opts?: Object);
class Presence {
constructor(channel: Channel, opts?: object);
onJoin(callback: Function): void;
onLeave(callback: Function): void;
onSync(callback: Function): void;
list<T = any>(chooser?: (key: string, presence: any) => T): T[];
inPendingSyncState(): boolean;
static syncState(
currentState: any,
newState: any,
currentState: object,
newState: object,
onJoin?: (key?: string, currentPresence?: any, newPresence?: any) => void,

@@ -144,4 +156,4 @@ onLeave?: (key?: string, currentPresence?: any, newPresence?: any) => void

static syncDiff(
currentState: any,
newState: any,
currentState: object,
diff: {joins: object; leaves: object},
onJoin?: (key?: string, currentPresence?: any, newPresence?: any) => void,

@@ -151,4 +163,7 @@ onLeave?: (key?: string, currentPresence?: any, newPresence?: any) => void

static list(presences: Object, chooser?: Function): any;
static list<T = any>(
presences: object,
chooser?: (key: string, presence: any) => T,
): T[];
}
}
{
"name": "@types/phoenix",
"version": "0.0.5",
"version": "1.4.0",
"description": "TypeScript definitions for phoenix",

@@ -16,2 +16,7 @@ "license": "MIT",

"githubUsername": "John-Goff"
},
{
"name": "Po Chen",
"url": "https://github.com/princemaple",
"githubUsername": "princemaple"
}

@@ -23,8 +28,9 @@ ],

"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git"
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/phoenix"
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "1d6d9f0521a3b5af866aa471a7b253573a895a352b326ce3e8bb50bb7d3cb509",
"typeScriptVersion": "2.0"
"typesPublisherContentHash": "75863a2372cdb57fefeb21126d809b95fe332f29e25857e8b417907b2407969a",
"typeScriptVersion": "2.4"
}

@@ -11,3 +11,3 @@ # Installation

Additional Details
* Last updated: Thu, 14 Feb 2019 16:52:11 GMT
* Last updated: Wed, 06 Mar 2019 19:47:03 GMT
* Dependencies: none

@@ -17,2 +17,2 @@ * Global values: none

# Credits
These definitions were written by Mirosław Ciastek <https://github.com/mciastek>, John Goff <https://github.com/John-Goff>.
These definitions were written by Mirosław Ciastek <https://github.com/mciastek>, John Goff <https://github.com/John-Goff>, Po Chen <https://github.com/princemaple>.
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