-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael
committed
Feb 2, 2019
1 parent
3dc9d43
commit 6d5501c
Showing
16 changed files
with
195 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare const _default: (str1: string) => string; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import "./types"; | ||
declare class WebSocketClient implements wsc.WebSocketClient { | ||
private open; | ||
private ws; | ||
private forcibly_closed; | ||
private reconnect_timeout; | ||
private queue; | ||
private messages; | ||
private onReadyQueue; | ||
private onCloseQueue; | ||
private config; | ||
private init_flush; | ||
private log; | ||
private connect; | ||
readonly socket: any; | ||
ready(): Promise<{}>; | ||
on(event_name: string, handler: (data: any) => any, predicate?: (data: any) => boolean): void; | ||
close(): wsc.AsyncErrCode; | ||
send(message_data: any, opts?: wsc.SendOptions): wsc.AsyncErrCode; | ||
constructor(user_config?: wsc.UserConfig); | ||
} | ||
export default WebSocketClient; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import "./types"; | ||
declare const connectLib: (ff: any) => any; | ||
export default connectLib; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
declare namespace wsc { | ||
/** Stuff that in use by this lib. */ | ||
interface Socket { | ||
readyState: number; | ||
send(...any: any[]): void; | ||
close(): void; | ||
addEventListener(event: string, handler: ((event: any) => any), ...any: any[]): void; | ||
} | ||
type AsyncErrCode = Promise<number | null | {}>; | ||
type EventHandler = (e: any) => void; | ||
type DataPipe = (message: any) => any; | ||
type DataType = 'json' | 'string'; | ||
interface Config { | ||
data_type: DataType; | ||
log(event: string, time?: number, message?: any): void; | ||
log(event: string, message?: any): void; | ||
timer: boolean; | ||
url: string; | ||
timeout: number; | ||
reconnect: number; | ||
lazy: boolean; | ||
socket: Socket; | ||
adapter: (host: string, protocols?: string[]) => Socket; | ||
encode: (key: string, message: any, config: Config) => any; | ||
decode: (rawMessage: any) => { | ||
[id_or_data_key: string]: string; | ||
}; | ||
protocols: string[]; | ||
pipes: DataPipe[]; | ||
server: { | ||
id_key: string; | ||
data_key: string; | ||
}; | ||
} | ||
type UserConfig = Partial<Config>; | ||
interface SendOptions { | ||
top: any; | ||
data_type: DataType; | ||
} | ||
class WebSocketClient { | ||
on(event_name: string, handler: (event: string) => void, predicate?: (event: string) => boolean): void; | ||
close(): Promise<void | {}>; | ||
send(user_message: any, opts: wsc.SendOptions): AsyncErrCode; | ||
constructor(user_config: wsc.UserConfig); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import "./types"; | ||
declare const add_event: (o: wsc.Socket, e: string, handler: wsc.EventHandler) => void; | ||
declare const once: (fn: Function) => (...args: any) => any; | ||
export { add_event, once, }; |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.