@types/phoenix
Advanced tools
Comparing version 1.6.1 to 1.6.2
@@ -9,50 +9,50 @@ // Type definitions for phoenix 1.6 | ||
export type PushStatus = 'ok' | 'error' | 'timeout'; | ||
export type PushStatus = "ok" | "error" | "timeout"; | ||
export class Push { | ||
constructor(channel: Channel, event: string, payload: object, timeout: number); | ||
constructor(channel: Channel, event: string, payload: object, timeout: number); | ||
send(): void; | ||
resend(timeout: number): void; | ||
send(): void; | ||
resend(timeout: number): void; | ||
receive(status: PushStatus, callback: (response?: any) => any): this; | ||
receive(status: PushStatus, callback: (response?: any) => any): this; | ||
} | ||
export type ChannelState = 'closed' | 'errored' | 'joined' | 'joining' | 'leaving'; | ||
export type ChannelState = "closed" | "errored" | "joined" | "joining" | "leaving"; | ||
export class Channel { | ||
constructor(topic: string, params?: object | (() => object), socket?: Socket); | ||
constructor(topic: string, params?: object | (() => object), socket?: Socket); | ||
state: ChannelState; | ||
topic: string; | ||
state: ChannelState; | ||
topic: string; | ||
join(timeout?: number): Push; | ||
leave(timeout?: number): Push; | ||
join(timeout?: number): Push; | ||
leave(timeout?: number): Push; | ||
onClose(callback: (payload: any, ref: any, joinRef: any) => void | Promise<void>): number; | ||
onError(callback: (reason?: any) => void | Promise<void>): number; | ||
onMessage(event: string, payload: any, ref: any): any; | ||
onClose(callback: (payload: any, ref: any, joinRef: any) => void | Promise<void>): number; | ||
onError(callback: (reason?: any) => void | Promise<void>): number; | ||
onMessage(event: string, payload: any, ref: any): any; | ||
on(event: string, callback: (response?: any) => void | Promise<void>): number; | ||
off(event: string, ref?: number): void; | ||
on(event: string, callback: (response?: any) => void | Promise<void>): number; | ||
off(event: string, ref?: number): void; | ||
push(event: string, payload: object, timeout?: number): Push; | ||
push(event: string, payload: object, timeout?: number): Push; | ||
} | ||
export type BinaryType = 'arraybuffer' | 'blob'; | ||
export type ConnectionState = 'connecting' | 'open' | 'closing' | 'closed'; | ||
export type BinaryType = "arraybuffer" | "blob"; | ||
export type ConnectionState = "connecting" | "open" | "closing" | "closed"; | ||
export interface SocketConnectOption { | ||
binaryType: BinaryType; | ||
params: object | (() => object); | ||
transport: new (endpoint: string) => object; | ||
timeout: number; | ||
heartbeatIntervalMs: number; | ||
longpollerTimeout: number; | ||
encode: (payload: object, callback: (encoded: any) => void | Promise<void>) => void; | ||
decode: (payload: string, callback: (decoded: any) => void | Promise<void>) => void; | ||
logger: (kind: string, message: string, data: any) => void; | ||
reconnectAfterMs: (tries: number) => number; | ||
rejoinAfterMs: (tries: number) => number; | ||
vsn: string; | ||
binaryType: BinaryType; | ||
params: object | (() => object); | ||
transport: new(endpoint: string) => object; | ||
timeout: number; | ||
heartbeatIntervalMs: number; | ||
longpollerTimeout: number; | ||
encode: (payload: object, callback: (encoded: any) => void | Promise<void>) => void; | ||
decode: (payload: string, callback: (decoded: any) => void | Promise<void>) => void; | ||
logger: (kind: string, message: string, data: any) => void; | ||
reconnectAfterMs: (tries: number) => number; | ||
rejoinAfterMs: (tries: number) => number; | ||
vsn: string; | ||
} | ||
@@ -63,42 +63,48 @@ | ||
export class Socket { | ||
constructor(endPoint: string, opts?: Partial<SocketConnectOption>); | ||
constructor(endPoint: string, opts?: Partial<SocketConnectOption>); | ||
protocol(): string; | ||
endPointURL(): string; | ||
protocol(): string; | ||
endPointURL(): string; | ||
connect(params?: any): void; | ||
disconnect(callback?: () => void | Promise<void>, code?: number, reason?: string): void; | ||
connectionState(): ConnectionState; | ||
isConnected(): boolean; | ||
replaceTransport(transport: new (endpoint: string) => object): void; | ||
connect(params?: any): void; | ||
disconnect(callback?: () => void | Promise<void>, code?: number, reason?: string): void; | ||
connectionState(): ConnectionState; | ||
isConnected(): boolean; | ||
replaceTransport(transport: new(endpoint: string) => object): void; | ||
remove(channel: Channel): void; | ||
channel(topic: string, chanParams?: object): Channel; | ||
push(data: object): void; | ||
remove(channel: Channel): void; | ||
channel(topic: string, chanParams?: object): Channel; | ||
push(data: object): void; | ||
log(kind: string, message: string, data: any): void; | ||
hasLogger(): boolean; | ||
log(kind: string, message: string, data: any): void; | ||
hasLogger(): boolean; | ||
onOpen(callback: () => void | Promise<void>): MessageRef; | ||
onClose(callback: (event: CloseEvent) => void | Promise<void>): MessageRef; | ||
onError(callback: (error: Event | string | number, transport: new (endpoint: string) => object, establishedConnections: number) => void | Promise<void>): MessageRef; | ||
onMessage(callback: (message: object) => void | Promise<void>): MessageRef; | ||
onOpen(callback: () => void | Promise<void>): MessageRef; | ||
onClose(callback: (event: CloseEvent) => void | Promise<void>): MessageRef; | ||
onError( | ||
callback: ( | ||
error: Event | string | number, | ||
transport: new(endpoint: string) => object, | ||
establishedConnections: number, | ||
) => void | Promise<void>, | ||
): MessageRef; | ||
onMessage(callback: (message: object) => void | Promise<void>): MessageRef; | ||
makeRef(): MessageRef; | ||
off(refs: MessageRef[]): void; | ||
makeRef(): MessageRef; | ||
off(refs: MessageRef[]): void; | ||
} | ||
export class LongPoll { | ||
constructor(endPoint: string); | ||
constructor(endPoint: string); | ||
normalizeEndpoint(endPoint: string): string; | ||
endpointURL(): string; | ||
normalizeEndpoint(endPoint: string): string; | ||
endpointURL(): string; | ||
closeAndRetry(): void; | ||
ontimeout(): void; | ||
closeAndRetry(): void; | ||
ontimeout(): void; | ||
poll(): void; | ||
poll(): void; | ||
send(body: any): void; | ||
close(code?: any, reason?: any): void; | ||
send(body: any): void; | ||
close(code?: any, reason?: any): void; | ||
} | ||
@@ -108,64 +114,64 @@ | ||
export class Ajax { | ||
static states: { [state: string]: number }; | ||
static states: { [state: string]: number }; | ||
static request( | ||
method: string, | ||
endPoint: string, | ||
accept: string, | ||
body: any, | ||
timeout?: number, | ||
ontimeout?: any, | ||
callback?: (response?: any) => void | Promise<void>, | ||
): void; | ||
static request( | ||
method: string, | ||
endPoint: string, | ||
accept: string, | ||
body: any, | ||
timeout?: number, | ||
ontimeout?: any, | ||
callback?: (response?: any) => void | Promise<void>, | ||
): void; | ||
static xdomainRequest( | ||
req: any, | ||
method: string, | ||
endPoint: string, | ||
body: any, | ||
timeout?: number, | ||
ontimeout?: any, | ||
callback?: (response?: any) => void | Promise<void>, | ||
): void; | ||
static xdomainRequest( | ||
req: any, | ||
method: string, | ||
endPoint: string, | ||
body: any, | ||
timeout?: number, | ||
ontimeout?: any, | ||
callback?: (response?: any) => void | Promise<void>, | ||
): void; | ||
static xhrRequest( | ||
req: any, | ||
method: string, | ||
endPoint: string, | ||
accept: string, | ||
body: any, | ||
timeout?: number, | ||
ontimeout?: any, | ||
callback?: (response?: any) => void | Promise<void>, | ||
): void; | ||
static xhrRequest( | ||
req: any, | ||
method: string, | ||
endPoint: string, | ||
accept: string, | ||
body: any, | ||
timeout?: number, | ||
ontimeout?: any, | ||
callback?: (response?: any) => void | Promise<void>, | ||
): void; | ||
static parseJSON(resp: string): JSON; | ||
static serialize(obj: any, parentKey: string): string; | ||
static 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?: PresenceOpts); | ||
constructor(channel: Channel, opts?: PresenceOpts); | ||
onJoin(callback: PresenceOnJoinCallback): void; | ||
onLeave(callback: PresenceOnLeaveCallback): void; | ||
onSync(callback: () => void | Promise<void>): void; | ||
list<T = any>(chooser?: (key: string, presence: any) => T): T[]; | ||
inPendingSyncState(): boolean; | ||
onJoin(callback: PresenceOnJoinCallback): void; | ||
onLeave(callback: PresenceOnLeaveCallback): void; | ||
onSync(callback: () => void | Promise<void>): void; | ||
list<T = any>(chooser?: (key: string, presence: any) => T): T[]; | ||
inPendingSyncState(): boolean; | ||
static syncState( | ||
currentState: object, | ||
newState: object, | ||
onJoin?: PresenceOnJoinCallback, | ||
onLeave?: PresenceOnLeaveCallback, | ||
): any; | ||
static syncState( | ||
currentState: object, | ||
newState: object, | ||
onJoin?: PresenceOnJoinCallback, | ||
onLeave?: PresenceOnLeaveCallback, | ||
): any; | ||
static syncDiff( | ||
currentState: object, | ||
diff: { joins: object; leaves: object }, | ||
onJoin?: PresenceOnJoinCallback, | ||
onLeave?: PresenceOnLeaveCallback, | ||
): any; | ||
static syncDiff( | ||
currentState: object, | ||
diff: { joins: object; leaves: object }, | ||
onJoin?: PresenceOnJoinCallback, | ||
onLeave?: PresenceOnLeaveCallback, | ||
): any; | ||
static list<T = any>(presences: object, chooser?: (key: string, presence: any) => T): T[]; | ||
static list<T = any>(presences: object, chooser?: (key: string, presence: any) => T): T[]; | ||
} | ||
@@ -178,10 +184,10 @@ | ||
export interface PresenceOpts { | ||
events?: { state: string; diff: string } | undefined; | ||
events?: { state: string; diff: string } | undefined; | ||
} | ||
export class Timer { | ||
constructor(callback: () => void | Promise<void>, timerCalc: (tries: number) => number); | ||
constructor(callback: () => void | Promise<void>, timerCalc: (tries: number) => number); | ||
reset(): void; | ||
scheduleTimeout(): void; | ||
reset(): void; | ||
scheduleTimeout(): void; | ||
} |
{ | ||
"name": "@types/phoenix", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"description": "TypeScript definitions for phoenix", | ||
@@ -33,4 +33,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/phoenix", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "c615fac4f158b3e90cb679597ea3f1e1ee23d0eeb22f90117f0e6a52867041e3", | ||
"typeScriptVersion": "4.3" | ||
"typesPublisherContentHash": "f0949d9376a7e1c3efc7274f5ecb563c8d0865d845ecdedd9fe6c2b63dba9038", | ||
"typeScriptVersion": "4.5" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Tue, 29 Aug 2023 23:38:52 GMT | ||
* Last updated: Sun, 24 Sep 2023 06:37:28 GMT | ||
* Dependencies: none | ||
@@ -14,0 +14,0 @@ * Global values: none |
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
8686
148