feat(plugins): add c2.WebSocket (#6076)
This commit is contained in:
Vendored
+23
-1
@@ -1,6 +1,6 @@
|
||||
/** @noSelfInFile */
|
||||
|
||||
declare module c2 {
|
||||
declare namespace c2 {
|
||||
enum LogLevel {
|
||||
Debug,
|
||||
Info,
|
||||
@@ -129,4 +129,26 @@ declare module c2 {
|
||||
|
||||
function register_callback<T>(type: T, func: CbFunc<T>): void;
|
||||
function later(callback: () => void, msec: number): void;
|
||||
|
||||
interface WebSocket {
|
||||
close(): void;
|
||||
send_text(data: string): void;
|
||||
send_binary(data: string): void;
|
||||
on_close: null | (() => void);
|
||||
on_text: null | ((data: string) => void);
|
||||
on_binary: null | ((data: string) => void);
|
||||
}
|
||||
interface WebSocketConstructor {
|
||||
new: (
|
||||
this: void,
|
||||
url: string,
|
||||
options?: {
|
||||
headers?: Record<string, string>;
|
||||
on_close?: () => void;
|
||||
on_text?: (data: string) => void;
|
||||
on_binary?: (data: string) => void;
|
||||
}
|
||||
) => WebSocket;
|
||||
}
|
||||
var WebSocket: WebSocketConstructor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user