knight-web 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/frame/base/AbstractObject.d.ts +36 -36
- package/frame/base/AbstractPanel.d.ts +4 -4
- package/frame/base/index.d.ts +2 -2
- package/frame/core/Knight.d.ts +42 -42
- package/frame/core/Navgation.d.ts +26 -26
- package/frame/core/index.d.ts +2 -2
- package/frame/index.d.ts +3 -4
- package/frame/utility/BrowserUtility.d.ts +320 -320
- package/frame/utility/ConfigUtility.d.ts +33 -33
- package/frame/utility/CryptoUtility.d.ts +215 -215
- package/frame/utility/EnumUtility.d.ts +886 -886
- package/frame/utility/FileUtility.d.ts +31 -31
- package/frame/utility/InputUtility.d.ts +20 -20
- package/frame/utility/InterfaceUtility.d.ts +13 -13
- package/frame/utility/LogUtility.d.ts +44 -44
- package/frame/utility/MathUtility.d.ts +559 -559
- package/frame/utility/NetworkUtility.d.ts +155 -155
- package/frame/utility/ObjectUtility.d.ts +308 -308
- package/frame/utility/ProfilerUtility.d.ts +37 -37
- package/frame/utility/PromiseUtility.d.ts +89 -89
- package/frame/utility/ReflectionUtility.d.ts +316 -316
- package/frame/utility/StringUtility.d.ts +55 -55
- package/frame/utility/index.d.ts +15 -15
- package/index.d.ts +1 -1
- package/knight-web.js +84 -0
- package/knight-web.js.map +1 -0
- package/package.json +2 -2
- package/readme.md +36 -0
- package/knight.js +0 -63
- package/knight.js.map +0 -1
|
@@ -1,155 +1,155 @@
|
|
|
1
|
-
/** 网络工具 */
|
|
2
|
-
export declare namespace NetworkUtility {
|
|
3
|
-
/** 网络类 */
|
|
4
|
-
class NetWork {
|
|
5
|
-
/** HTTP网络协议 */
|
|
6
|
-
private _http;
|
|
7
|
-
/** HTTP网络协议 */
|
|
8
|
-
get HTTP(): HttpNetwork;
|
|
9
|
-
/** WebSocket网络协议 */
|
|
10
|
-
private _webSokcet;
|
|
11
|
-
/** WebSocket网络协议 */
|
|
12
|
-
get WebSokcet(): WebSocketNetWork;
|
|
13
|
-
/** 构造函数 */
|
|
14
|
-
constructor();
|
|
15
|
-
}
|
|
16
|
-
/** HTTP网络协议 */
|
|
17
|
-
class HttpNetwork {
|
|
18
|
-
/** 构造函数 */
|
|
19
|
-
constructor();
|
|
20
|
-
/**
|
|
21
|
-
* 网络请求
|
|
22
|
-
* @param _type 请求类型
|
|
23
|
-
* @param _url 格式: "http://192.168.1.1/aaa/bbb"或"https://192.168.1.1/aaa/bbb"
|
|
24
|
-
* @param _data 传递的数据
|
|
25
|
-
* @param _header 请求头
|
|
26
|
-
* @returns 返回请求的数据
|
|
27
|
-
*/
|
|
28
|
-
Request(_url: string, _option?: IRequest): Promise<IResponse>;
|
|
29
|
-
/** 网络请求执行器 */
|
|
30
|
-
private OnRequestExecutor;
|
|
31
|
-
/** 尝试解析响应数据 */
|
|
32
|
-
private OnTryParseResponse;
|
|
33
|
-
}
|
|
34
|
-
/** WebSocket网络协议 */
|
|
35
|
-
class WebSocketNetWork {
|
|
36
|
-
/** WebSocket套接字 */
|
|
37
|
-
private _websocket;
|
|
38
|
-
/** 心跳计数器 */
|
|
39
|
-
private _heartbeatCounter;
|
|
40
|
-
/** 心跳间隔 */
|
|
41
|
-
private _heartbeatInterval;
|
|
42
|
-
/** 心跳响应计数器 */
|
|
43
|
-
private _heartbeatResponseCounter;
|
|
44
|
-
/** 心跳超时次数 */
|
|
45
|
-
private _heartbeatTimeoutCount;
|
|
46
|
-
/** 心跳开关 */
|
|
47
|
-
private _heartbeatSwitch;
|
|
48
|
-
/** 打开回调事件 */
|
|
49
|
-
Evt_OnOpen: (_ws: WebSocketNetWork, _event?: Event) => void;
|
|
50
|
-
/** 关闭回调事件 */
|
|
51
|
-
Evt_OnClosed: (_ws: WebSocketNetWork, _event?: CloseEvent) => void;
|
|
52
|
-
/** 报错回调事件 */
|
|
53
|
-
Evt_OnError: (_ws: WebSocketNetWork, _event?: Event) => void;
|
|
54
|
-
/** 接收回调事件 */
|
|
55
|
-
Evt_OnReceive: (_ws: WebSocketNetWork, _event?: MessageEvent<any>) => void;
|
|
56
|
-
/** 心跳超时回调事件 */
|
|
57
|
-
Evt_OnHeartbeatTimeout: () => void;
|
|
58
|
-
/** 构造函数 */
|
|
59
|
-
constructor();
|
|
60
|
-
/** 开启连接 */
|
|
61
|
-
OnConnect(_url: string): void;
|
|
62
|
-
/** 客户端断开连接 */
|
|
63
|
-
OnDisConnect(): void;
|
|
64
|
-
/** 启动心跳 */
|
|
65
|
-
private OnStartHeartbeat;
|
|
66
|
-
/** 心跳逻辑 */
|
|
67
|
-
private OnHeartbeat;
|
|
68
|
-
/** 客户端打开连接 */
|
|
69
|
-
private OnOpen;
|
|
70
|
-
/** 客户端断开连接 */
|
|
71
|
-
OnClose(_event?: CloseEvent): void;
|
|
72
|
-
/** 客户端报错 */
|
|
73
|
-
private OnError;
|
|
74
|
-
/** 发送消息 */
|
|
75
|
-
OnSend(_data: string | Blob | ArrayBufferView | ArrayBufferLike): void;
|
|
76
|
-
/** 接收消息 */
|
|
77
|
-
private OnReceive;
|
|
78
|
-
}
|
|
79
|
-
/** 请求参数接口 */
|
|
80
|
-
interface IRequest {
|
|
81
|
-
/** 请求协议类型 */
|
|
82
|
-
method?: string | E_RequestType;
|
|
83
|
-
/** URL链接中的参数 */
|
|
84
|
-
params?: {
|
|
85
|
-
[key: string]: string;
|
|
86
|
-
};
|
|
87
|
-
/** 请求头 */
|
|
88
|
-
headers?: HeadersInit;
|
|
89
|
-
/** 请求体 */
|
|
90
|
-
body?: XMLHttpRequestBodyInit;
|
|
91
|
-
/** 设置请求的凭证 */
|
|
92
|
-
credentials?: RequestCredentials;
|
|
93
|
-
/** 设置请求的keepalive */
|
|
94
|
-
keepalive?: boolean;
|
|
95
|
-
/** 请求模式 */
|
|
96
|
-
mode?: RequestMode;
|
|
97
|
-
/** A string indicating how the request will interact with the browser's cache to set request's cache. */
|
|
98
|
-
cache?: RequestCache;
|
|
99
|
-
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
100
|
-
integrity?: string;
|
|
101
|
-
priority?: "auto" | "high" | "low";
|
|
102
|
-
/** A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */
|
|
103
|
-
redirect?: RequestRedirect;
|
|
104
|
-
/** A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer. */
|
|
105
|
-
referrer?: string;
|
|
106
|
-
/** A referrer policy to set request's referrerPolicy. */
|
|
107
|
-
referrerPolicy?: ReferrerPolicy;
|
|
108
|
-
/** An AbortSignal to set request's signal. */
|
|
109
|
-
signal?: AbortSignal | null;
|
|
110
|
-
/** Can only be null. Used to disassociate request from any Window. */
|
|
111
|
-
window?: null;
|
|
112
|
-
}
|
|
113
|
-
/** 响应参数接口 */
|
|
114
|
-
interface IResponse {
|
|
115
|
-
/** 响应地址 */
|
|
116
|
-
responseURL?: string;
|
|
117
|
-
/** 相应数据类型(数据格式) */
|
|
118
|
-
responseType?: XMLHttpRequestResponseType;
|
|
119
|
-
/** 准备状态 */
|
|
120
|
-
readyState?: number;
|
|
121
|
-
/** 响应码 */
|
|
122
|
-
status?: number;
|
|
123
|
-
/** 响应码(字符串格式) */
|
|
124
|
-
statusText?: string;
|
|
125
|
-
/** 响应信息 */
|
|
126
|
-
/** 是否携带Cookie */
|
|
127
|
-
withCredentials?: boolean;
|
|
128
|
-
/** 超时时间(ms) */
|
|
129
|
-
timeout?: number;
|
|
130
|
-
/** 响应数据 */
|
|
131
|
-
response?: any;
|
|
132
|
-
/** 响应数据(字符串格式) */
|
|
133
|
-
responseText?: string;
|
|
134
|
-
/** 响应数据(文档格式) */
|
|
135
|
-
responseXML?: Document | null;
|
|
136
|
-
/** 准备状态变更事件 */
|
|
137
|
-
onreadystatechange?: ((this: XMLHttpRequest, ev: Event) => any) | null;
|
|
138
|
-
/** 获取所有响应请求头 */
|
|
139
|
-
getAllResponseHeaders?(): string;
|
|
140
|
-
/** 响应数据转换 */
|
|
141
|
-
ParseResponse?<T>(): T;
|
|
142
|
-
}
|
|
143
|
-
/** 请求类型 */
|
|
144
|
-
enum E_RequestType {
|
|
145
|
-
All = "all",
|
|
146
|
-
Get = "get",
|
|
147
|
-
Post = "post",
|
|
148
|
-
Put = "put",
|
|
149
|
-
Delete = "delete",
|
|
150
|
-
Patch = "patch",
|
|
151
|
-
Options = "options",
|
|
152
|
-
Head = "head",
|
|
153
|
-
Search = "search"
|
|
154
|
-
}
|
|
155
|
-
}
|
|
1
|
+
/** 网络工具 */
|
|
2
|
+
export declare namespace NetworkUtility {
|
|
3
|
+
/** 网络类 */
|
|
4
|
+
class NetWork {
|
|
5
|
+
/** HTTP网络协议 */
|
|
6
|
+
private _http;
|
|
7
|
+
/** HTTP网络协议 */
|
|
8
|
+
get HTTP(): HttpNetwork;
|
|
9
|
+
/** WebSocket网络协议 */
|
|
10
|
+
private _webSokcet;
|
|
11
|
+
/** WebSocket网络协议 */
|
|
12
|
+
get WebSokcet(): WebSocketNetWork;
|
|
13
|
+
/** 构造函数 */
|
|
14
|
+
constructor();
|
|
15
|
+
}
|
|
16
|
+
/** HTTP网络协议 */
|
|
17
|
+
class HttpNetwork {
|
|
18
|
+
/** 构造函数 */
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* 网络请求
|
|
22
|
+
* @param _type 请求类型
|
|
23
|
+
* @param _url 格式: "http://192.168.1.1/aaa/bbb"或"https://192.168.1.1/aaa/bbb"
|
|
24
|
+
* @param _data 传递的数据
|
|
25
|
+
* @param _header 请求头
|
|
26
|
+
* @returns 返回请求的数据
|
|
27
|
+
*/
|
|
28
|
+
Request(_url: string, _option?: IRequest): Promise<IResponse>;
|
|
29
|
+
/** 网络请求执行器 */
|
|
30
|
+
private OnRequestExecutor;
|
|
31
|
+
/** 尝试解析响应数据 */
|
|
32
|
+
private OnTryParseResponse;
|
|
33
|
+
}
|
|
34
|
+
/** WebSocket网络协议 */
|
|
35
|
+
class WebSocketNetWork {
|
|
36
|
+
/** WebSocket套接字 */
|
|
37
|
+
private _websocket;
|
|
38
|
+
/** 心跳计数器 */
|
|
39
|
+
private _heartbeatCounter;
|
|
40
|
+
/** 心跳间隔 */
|
|
41
|
+
private _heartbeatInterval;
|
|
42
|
+
/** 心跳响应计数器 */
|
|
43
|
+
private _heartbeatResponseCounter;
|
|
44
|
+
/** 心跳超时次数 */
|
|
45
|
+
private _heartbeatTimeoutCount;
|
|
46
|
+
/** 心跳开关 */
|
|
47
|
+
private _heartbeatSwitch;
|
|
48
|
+
/** 打开回调事件 */
|
|
49
|
+
Evt_OnOpen: (_ws: WebSocketNetWork, _event?: Event) => void;
|
|
50
|
+
/** 关闭回调事件 */
|
|
51
|
+
Evt_OnClosed: (_ws: WebSocketNetWork, _event?: CloseEvent) => void;
|
|
52
|
+
/** 报错回调事件 */
|
|
53
|
+
Evt_OnError: (_ws: WebSocketNetWork, _event?: Event) => void;
|
|
54
|
+
/** 接收回调事件 */
|
|
55
|
+
Evt_OnReceive: (_ws: WebSocketNetWork, _event?: MessageEvent<any>) => void;
|
|
56
|
+
/** 心跳超时回调事件 */
|
|
57
|
+
Evt_OnHeartbeatTimeout: () => void;
|
|
58
|
+
/** 构造函数 */
|
|
59
|
+
constructor();
|
|
60
|
+
/** 开启连接 */
|
|
61
|
+
OnConnect(_url: string): void;
|
|
62
|
+
/** 客户端断开连接 */
|
|
63
|
+
OnDisConnect(): void;
|
|
64
|
+
/** 启动心跳 */
|
|
65
|
+
private OnStartHeartbeat;
|
|
66
|
+
/** 心跳逻辑 */
|
|
67
|
+
private OnHeartbeat;
|
|
68
|
+
/** 客户端打开连接 */
|
|
69
|
+
private OnOpen;
|
|
70
|
+
/** 客户端断开连接 */
|
|
71
|
+
OnClose(_event?: CloseEvent): void;
|
|
72
|
+
/** 客户端报错 */
|
|
73
|
+
private OnError;
|
|
74
|
+
/** 发送消息 */
|
|
75
|
+
OnSend(_data: string | Blob | ArrayBufferView | ArrayBufferLike): void;
|
|
76
|
+
/** 接收消息 */
|
|
77
|
+
private OnReceive;
|
|
78
|
+
}
|
|
79
|
+
/** 请求参数接口 */
|
|
80
|
+
interface IRequest {
|
|
81
|
+
/** 请求协议类型 */
|
|
82
|
+
method?: string | E_RequestType;
|
|
83
|
+
/** URL链接中的参数 */
|
|
84
|
+
params?: {
|
|
85
|
+
[key: string]: string;
|
|
86
|
+
};
|
|
87
|
+
/** 请求头 */
|
|
88
|
+
headers?: HeadersInit;
|
|
89
|
+
/** 请求体 */
|
|
90
|
+
body?: XMLHttpRequestBodyInit;
|
|
91
|
+
/** 设置请求的凭证 */
|
|
92
|
+
credentials?: RequestCredentials;
|
|
93
|
+
/** 设置请求的keepalive */
|
|
94
|
+
keepalive?: boolean;
|
|
95
|
+
/** 请求模式 */
|
|
96
|
+
mode?: RequestMode;
|
|
97
|
+
/** A string indicating how the request will interact with the browser's cache to set request's cache. */
|
|
98
|
+
cache?: RequestCache;
|
|
99
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
100
|
+
integrity?: string;
|
|
101
|
+
priority?: "auto" | "high" | "low";
|
|
102
|
+
/** A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */
|
|
103
|
+
redirect?: RequestRedirect;
|
|
104
|
+
/** A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer. */
|
|
105
|
+
referrer?: string;
|
|
106
|
+
/** A referrer policy to set request's referrerPolicy. */
|
|
107
|
+
referrerPolicy?: ReferrerPolicy;
|
|
108
|
+
/** An AbortSignal to set request's signal. */
|
|
109
|
+
signal?: AbortSignal | null;
|
|
110
|
+
/** Can only be null. Used to disassociate request from any Window. */
|
|
111
|
+
window?: null;
|
|
112
|
+
}
|
|
113
|
+
/** 响应参数接口 */
|
|
114
|
+
interface IResponse {
|
|
115
|
+
/** 响应地址 */
|
|
116
|
+
responseURL?: string;
|
|
117
|
+
/** 相应数据类型(数据格式) */
|
|
118
|
+
responseType?: XMLHttpRequestResponseType;
|
|
119
|
+
/** 准备状态 */
|
|
120
|
+
readyState?: number;
|
|
121
|
+
/** 响应码 */
|
|
122
|
+
status?: number;
|
|
123
|
+
/** 响应码(字符串格式) */
|
|
124
|
+
statusText?: string;
|
|
125
|
+
/** 响应信息 */
|
|
126
|
+
/** 是否携带Cookie */
|
|
127
|
+
withCredentials?: boolean;
|
|
128
|
+
/** 超时时间(ms) */
|
|
129
|
+
timeout?: number;
|
|
130
|
+
/** 响应数据 */
|
|
131
|
+
response?: any;
|
|
132
|
+
/** 响应数据(字符串格式) */
|
|
133
|
+
responseText?: string;
|
|
134
|
+
/** 响应数据(文档格式) */
|
|
135
|
+
responseXML?: Document | null;
|
|
136
|
+
/** 准备状态变更事件 */
|
|
137
|
+
onreadystatechange?: ((this: XMLHttpRequest, ev: Event) => any) | null;
|
|
138
|
+
/** 获取所有响应请求头 */
|
|
139
|
+
getAllResponseHeaders?(): string;
|
|
140
|
+
/** 响应数据转换 */
|
|
141
|
+
ParseResponse?<T>(): T;
|
|
142
|
+
}
|
|
143
|
+
/** 请求类型 */
|
|
144
|
+
enum E_RequestType {
|
|
145
|
+
All = "all",
|
|
146
|
+
Get = "get",
|
|
147
|
+
Post = "post",
|
|
148
|
+
Put = "put",
|
|
149
|
+
Delete = "delete",
|
|
150
|
+
Patch = "patch",
|
|
151
|
+
Options = "options",
|
|
152
|
+
Head = "head",
|
|
153
|
+
Search = "search"
|
|
154
|
+
}
|
|
155
|
+
}
|