Skip to content

Commit

Permalink
update types.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael committed Feb 11, 2019
1 parent 39fdc2d commit 9d56c9f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 24 deletions.
2 changes: 1 addition & 1 deletion dist/src/WS.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import './types';
declare class WebSocketClient implements wsc.WebSocketClient {
declare class WebSocketClient {
private open;
private ws;
private forcibly_closed;
Expand Down
11 changes: 4 additions & 7 deletions dist/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
declare namespace wsc {
/** Stuff that in use by this lib. */
interface DataObject {
[key: string]: any;
}
/** Minimal socket-like interface. */
interface Socket {
readyState: number;
send(...any: any[]): void;
Expand Down Expand Up @@ -37,10 +40,4 @@ declare namespace wsc {
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);
}
}
2 changes: 1 addition & 1 deletion dist/ws.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ws.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/WS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const MAX_32 = 2**31 - 1
returns a Promise, that will be rejected after a timeout or
resolved if server returns the same signature: {id: `same_hash`, data: `response data`}
*/
class WebSocketClient implements wsc.WebSocketClient {
class WebSocketClient {

private open = null
private ws = null
Expand Down Expand Up @@ -85,7 +85,7 @@ class WebSocketClient implements wsc.WebSocketClient {
this.init_flush()
this.ws = null
this.forcibly_closed = true
ff()
ff(null)
})
this.ws.close()
}
Expand Down
17 changes: 5 additions & 12 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
declare namespace wsc {

/** Stuff that in use by this lib. */
interface DataObject {
[key: string]: any
}

/** Minimal socket-like interface. */
interface Socket {
readyState: number
send(...any: any[]): void
Expand Down Expand Up @@ -45,15 +49,4 @@ declare namespace wsc {
top: any
data_type: DataType
}

export 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)
}
}

0 comments on commit 9d56c9f

Please sign in to comment.