@types/phoenix
Advanced tools
Comparing version 1.4.0 to 1.4.1
// 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>, Po Chen <https://github.com/princemaple> | ||
// 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' { | ||
class Push { | ||
constructor( | ||
channel: Channel, | ||
event: string, | ||
payload: object, | ||
timeout: number, | ||
); | ||
export class Push { | ||
constructor( | ||
channel: Channel, | ||
event: string, | ||
payload: object, | ||
timeout: number, | ||
); | ||
send(): void; | ||
resend(timeout: number): void; | ||
send(): void; | ||
resend(timeout: number): void; | ||
receive(status: string, callback: (response?: any) => any): this; | ||
} | ||
receive(status: string, callback: (response?: any) => any): this; | ||
} | ||
class Channel { | ||
constructor(topic: string, params?: object | Function, socket?: Socket); | ||
export class Channel { | ||
constructor(topic: string, params?: object | (() => object), socket?: Socket); | ||
join(timeout?: number): Push; | ||
leave(timeout?: number): Push; | ||
join(timeout?: number): Push; | ||
leave(timeout?: number): Push; | ||
onClose(callback: Function): void; | ||
onError(callback: (reason?: any) => void): void; | ||
onMessage(event: string, payload: any, ref: any): any; | ||
onClose(callback: (payload: any, ref: any, joinRef: any) => void): void; | ||
onError(callback: (reason?: any) => void): void; | ||
onMessage(event: string, payload: any, ref: any): any; | ||
on(event: string, callback: (response?: any) => void): void; | ||
off(event: string): void; | ||
on(event: string, callback: (response?: any) => void): number; | ||
off(event: string): void; | ||
push(event: string, payload: object, timeout?: number): Push; | ||
} | ||
push(event: string, payload: object, timeout?: number): Push; | ||
} | ||
type ConnectionState = 'connecting' | 'open' | 'closing' | 'closed'; | ||
export 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 interface SocketConnectOption { | ||
params: object | (() => object); | ||
transport: string; | ||
timeout: number; | ||
heartbeatIntervalMs: number; | ||
reconnectAfterMs: number; | ||
longpollerTimeout: number; | ||
encode: (payload: object, callback: (encoded: any) => void) => void; | ||
decode: (payload: string, callback: (decoded: any) => void) => void; | ||
logger: (kind: string, message: string, data: any) => void; | ||
} | ||
class Socket { | ||
constructor(endPoint: string, opts?: Partial<SocketConnectOption>); | ||
export class Socket { | ||
constructor(endPoint: string, opts?: Partial<SocketConnectOption>); | ||
protocol(): string; | ||
endPointURL(): string; | ||
protocol(): string; | ||
endPointURL(): string; | ||
connect(params?: any): void; | ||
disconnect(callback?: Function, code?: number, reason?: string): void; | ||
connectionState(): ConnectionState; | ||
isConnected(): boolean; | ||
connect(params?: any): void; | ||
disconnect(callback?: () => void, code?: number, reason?: string): void; | ||
connectionState(): ConnectionState; | ||
isConnected(): boolean; | ||
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: object): void; | ||
hasLogger(): boolean; | ||
log(kind: string, message: string, data: any): void; | ||
hasLogger(): boolean; | ||
onOpen(callback: Function): void; | ||
onClose(callback: Function): void; | ||
onError(callback: Function): void; | ||
onMessage(callback: Function): void; | ||
onOpen(callback: () => void): void; | ||
onClose(callback: () => void): void; | ||
onError(callback: () => void): void; | ||
onMessage(callback: () => void): void; | ||
makeRef(): string; | ||
} | ||
makeRef(): string; | ||
} | ||
class LongPoll { | ||
constructor(endPoint: string); | ||
export class LongPoll { | ||
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; | ||
} | ||
class Ajax { | ||
static states: {[state: string]: number}; | ||
// tslint:disable:no-unnecessary-class | ||
export class Ajax { | ||
static states: {[state: string]: number}; | ||
static request( | ||
method: string, | ||
endPoint: string, | ||
accept: string, | ||
body: any, | ||
timeout?: number, | ||
ontimeout?: any, | ||
callback?: (response?: any) => void | ||
): void; | ||
static request( | ||
method: string, | ||
endPoint: string, | ||
accept: string, | ||
body: any, | ||
timeout?: number, | ||
ontimeout?: any, | ||
callback?: (response?: any) => void | ||
): void; | ||
static xdomainRequest( | ||
req: any, | ||
method: string, | ||
endPoint: string, | ||
body: any, | ||
timeout?: number, | ||
ontimeout?: any, | ||
callback?: (response?: any) => void | ||
): void; | ||
static xdomainRequest( | ||
req: any, | ||
method: string, | ||
endPoint: string, | ||
body: any, | ||
timeout?: number, | ||
ontimeout?: any, | ||
callback?: (response?: any) => void | ||
): void; | ||
static xhrRequest( | ||
req: any, | ||
method: string, | ||
endPoint: string, | ||
accept: string, | ||
body: any, | ||
timeout?: number, | ||
ontimeout?: any, | ||
callback?: (response?: any) => void | ||
): void; | ||
static xhrRequest( | ||
req: any, | ||
method: string, | ||
endPoint: string, | ||
accept: string, | ||
body: any, | ||
timeout?: number, | ||
ontimeout?: any, | ||
callback?: (response?: any) => 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; | ||
} | ||
class Presence { | ||
constructor(channel: Channel, opts?: object); | ||
export class Presence { | ||
constructor(channel: Channel, opts?: PresenceOpts); | ||
onJoin(callback: Function): void; | ||
onLeave(callback: Function): void; | ||
onSync(callback: Function): void; | ||
list<T = any>(chooser?: (key: string, presence: any) => T): T[]; | ||
inPendingSyncState(): boolean; | ||
onJoin(callback: PresenceOnJoinCallback): void; | ||
onLeave(callback: PresenceOnLeaveCallback): void; | ||
onSync(callback: () => void): void; | ||
list<T = any>(chooser?: (key: string, presence: any) => T): T[]; | ||
inPendingSyncState(): boolean; | ||
static syncState( | ||
currentState: object, | ||
newState: object, | ||
onJoin?: (key?: string, currentPresence?: any, newPresence?: any) => void, | ||
onLeave?: (key?: string, currentPresence?: any, newPresence?: any) => void | ||
): any; | ||
static syncState( | ||
currentState: object, | ||
newState: object, | ||
onJoin?: PresenceOnJoinCallback, | ||
onLeave?: PresenceOnLeaveCallback | ||
): any; | ||
static syncDiff( | ||
currentState: object, | ||
diff: {joins: object; leaves: object}, | ||
onJoin?: (key?: string, currentPresence?: any, newPresence?: any) => void, | ||
onLeave?: (key?: string, currentPresence?: any, newPresence?: any) => void | ||
): 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[]; | ||
} | ||
export type PresenceOnJoinCallback = ( | ||
key?: string, | ||
currentPresence?: any, | ||
newPresence?: any | ||
) => void; | ||
export type PresenceOnLeaveCallback = ( | ||
key?: string, | ||
currentPresence?: any, | ||
newPresence?: any | ||
) => void; | ||
export interface PresenceOpts { | ||
events?: { state: string; diff: string }; | ||
} |
{ | ||
"name": "@types/phoenix", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "TypeScript definitions for phoenix", | ||
@@ -32,4 +32,4 @@ "license": "MIT", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "75863a2372cdb57fefeb21126d809b95fe332f29e25857e8b417907b2407969a", | ||
"typesPublisherContentHash": "c0bc5e8a6253cf568af8d4dcaca9da8a41e311d88e653bd6647e49028e1fa950", | ||
"typeScriptVersion": "2.4" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Wed, 06 Mar 2019 19:47:03 GMT | ||
* Last updated: Mon, 03 Jun 2019 23:06:16 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
7239
142