@trimjs/web-app 0.4.2 → 0.6.0
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/README.md +36 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +449 -144
- package/dist/index.js +1 -1
- package/package.json +19 -16
- package/dist/app-auth.d.ts +0 -56
- package/dist/logger.d.ts +0 -42
- package/dist/mobile/index.d.ts +0 -53
- package/dist/mobile/types.d.ts +0 -10
- package/dist/types.d.ts +0 -42
- package/dist/utils/platform.d.ts +0 -3
- package/dist/web/extension.d.ts +0 -4
- package/dist/web/index.d.ts +0 -24
package/dist/index.d.ts
CHANGED
|
@@ -1,145 +1,450 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
*
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
*
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
*
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
*
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
*
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
*
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
1
|
+
declare interface App {
|
|
2
|
+
name: string;
|
|
3
|
+
icon: string;
|
|
4
|
+
headerIconVisible?: boolean;
|
|
5
|
+
appName: string;
|
|
6
|
+
serviceName?: string;
|
|
7
|
+
alias?: string;
|
|
8
|
+
type: AppType;
|
|
9
|
+
componentUrl?: string;
|
|
10
|
+
iframe?: boolean;
|
|
11
|
+
microApp?: boolean;
|
|
12
|
+
url?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
multiple?: boolean;
|
|
15
|
+
hiddenDesktopIcon?: boolean;
|
|
16
|
+
enableSettings?: boolean;
|
|
17
|
+
enableMaximize?: boolean;
|
|
18
|
+
width?: number;
|
|
19
|
+
style?: any;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export declare interface AppAuthAuthorizeParams extends AppAuthBaseParams {
|
|
23
|
+
path: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export declare interface AppAuthBaseParams {
|
|
27
|
+
appName: string;
|
|
28
|
+
redirectUri?: string;
|
|
29
|
+
state?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export declare type AppAuthCallbackError = 'access_denied';
|
|
33
|
+
|
|
34
|
+
export declare type AppAuthCallbackStatus = 'success' | 'cancel' | 'error';
|
|
35
|
+
|
|
36
|
+
export declare type AppAuthMethod = keyof typeof appAuthMethodRouteMap;
|
|
37
|
+
|
|
38
|
+
export declare interface AppAuthMethodParamsMap {
|
|
39
|
+
pickFile: AppAuthPickFileParams;
|
|
40
|
+
pickUserFile: AppAuthPickFileParams;
|
|
41
|
+
pickSharedFile: AppAuthPickSharedFileParams;
|
|
42
|
+
authorizeUserFile: AppAuthAuthorizeParams;
|
|
43
|
+
authorizeSharedFile: AppAuthAuthorizeParams;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare const appAuthMethodRouteMap: {
|
|
47
|
+
readonly pickFile: "pick-file";
|
|
48
|
+
readonly pickUserFile: "pick-user-file";
|
|
49
|
+
readonly pickSharedFile: "pick-shared-file";
|
|
50
|
+
readonly authorizeUserFile: "authorize-user-file";
|
|
51
|
+
readonly authorizeSharedFile: "authorize-shared-file";
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export declare type AppAuthParams<TMethod extends AppAuthMethod = AppAuthMethod> = AppAuthMethodParamsMap[TMethod];
|
|
55
|
+
|
|
56
|
+
export declare interface AppAuthPickFileParams extends AppAuthBaseParams {
|
|
57
|
+
directory?: boolean;
|
|
58
|
+
accept?: string[];
|
|
59
|
+
sidebarGroup?: FilePickerParams['sidebarGroup'];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export declare interface AppAuthPickSharedFileParams extends AppAuthBaseParams {
|
|
63
|
+
sidebarGroup?: FilePickerParams['sidebarGroup'];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export declare interface AppAuthResult {
|
|
67
|
+
status?: AppAuthCallbackStatus;
|
|
68
|
+
error?: AppAuthCallbackError;
|
|
69
|
+
method?: AppAuthMethod;
|
|
70
|
+
appName?: string;
|
|
71
|
+
state?: string;
|
|
72
|
+
path?: string[];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export declare type AppBridgeResponse<T> = {
|
|
76
|
+
code: number;
|
|
77
|
+
msg: string;
|
|
78
|
+
data: T;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
declare type AppBridgeResponse_2<T> = {
|
|
82
|
+
code: number;
|
|
83
|
+
msg: string;
|
|
84
|
+
data: T;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
declare enum AppType {
|
|
88
|
+
INBUILT = "inbuilt",// 内置应用
|
|
89
|
+
THIRD_PARTY = "third-party",// 第三方
|
|
90
|
+
TEMPORARY = "temporary"
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export declare type AuthorizeFileResult = boolean;
|
|
94
|
+
|
|
95
|
+
export declare interface FileDetailsOptions {
|
|
96
|
+
admin?: boolean;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export declare interface FilePickerParams {
|
|
100
|
+
/**
|
|
101
|
+
* 是否多选
|
|
102
|
+
*
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
multiple?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* 是否选择文件夹
|
|
108
|
+
*
|
|
109
|
+
* @default false
|
|
110
|
+
*/
|
|
111
|
+
directory?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* 接受的文件扩展名,仅支持以 `.` 开头的后缀
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* accept: ['.txt', '.jpg', '.png'];
|
|
117
|
+
*/
|
|
118
|
+
accept?: string[];
|
|
119
|
+
/**
|
|
120
|
+
* 可选的范围 传入顺序决定侧边栏的顺序 myFiles. 我的文件 otherShare. 他人共享 external. 外接存储 favorites. 我的收藏 storage.
|
|
121
|
+
* 存储空间(管理员)
|
|
122
|
+
*
|
|
123
|
+
* @default
|
|
124
|
+
* ['myFiles']
|
|
125
|
+
*/
|
|
126
|
+
sidebarGroup?: ('myFiles' | 'otherShare' | 'external' | 'remote' | 'favorites' | 'storage' | 'torrent' | 'team' | string)[];
|
|
127
|
+
/**
|
|
128
|
+
* 不可选的路径列表, 如果是路径也不可被展开
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* disabledPaths: ['/vol1/1000/xxx', '/vol2/1000/yyy'];
|
|
132
|
+
*/
|
|
133
|
+
disabledPaths?: string[];
|
|
134
|
+
/**
|
|
135
|
+
* 可选择的正则表达式(预留)
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* selectablePatterns: [['\\.(torrent|bt)$', 'i']];
|
|
139
|
+
*/
|
|
140
|
+
selectablePatterns?: [string, string][];
|
|
141
|
+
/**
|
|
142
|
+
* 扩充搜索 文件类型
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* expandFiles: [
|
|
146
|
+
* {
|
|
147
|
+
* title: '我的种子',
|
|
148
|
+
* extension: '.torrent',
|
|
149
|
+
* },
|
|
150
|
+
* ];
|
|
151
|
+
*/
|
|
152
|
+
expandFiles?: {
|
|
153
|
+
/**
|
|
154
|
+
* 侧边栏标题
|
|
155
|
+
*/
|
|
156
|
+
title: string;
|
|
157
|
+
/**
|
|
158
|
+
* 文件扩展名
|
|
159
|
+
*/
|
|
160
|
+
extension: string;
|
|
161
|
+
}[];
|
|
162
|
+
/**
|
|
163
|
+
* 是否允许创建文件夹
|
|
164
|
+
*
|
|
165
|
+
* @default true
|
|
166
|
+
*/
|
|
167
|
+
creatable?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* 标题
|
|
170
|
+
*
|
|
171
|
+
* @default '选择文件' | '选择文件夹'
|
|
172
|
+
*/
|
|
173
|
+
title?: string;
|
|
174
|
+
/**
|
|
175
|
+
* 确认按钮文本
|
|
176
|
+
*
|
|
177
|
+
* @default '确定'
|
|
178
|
+
*/
|
|
179
|
+
okText?: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export declare interface FlutterInAppWebView {
|
|
183
|
+
callHandler: (fn: string, ...params: Array<string | undefined>) => Promise<string>;
|
|
184
|
+
_platformReady?: boolean;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** Protocol support only; the host authorizes each request independently. */
|
|
188
|
+
export declare interface HostCapabilities {
|
|
189
|
+
runtime: 'desktop' | 'web' | 'mobile' | 'unknown';
|
|
190
|
+
sessionCredentials?: 1;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export declare interface HostSnapshot {
|
|
194
|
+
status: string;
|
|
195
|
+
host?: string;
|
|
196
|
+
username?: string;
|
|
197
|
+
currentSessionId?: string;
|
|
198
|
+
sessions: Array<{
|
|
199
|
+
id: string;
|
|
200
|
+
label: string;
|
|
201
|
+
host?: string;
|
|
202
|
+
username?: string;
|
|
203
|
+
}>;
|
|
204
|
+
errorMessage?: string;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export declare type MobileObservableQueryResult<T> = ResponseData<T> & {
|
|
208
|
+
reqId: string;
|
|
209
|
+
result?: string;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
declare type ObservableLike<T> = {
|
|
213
|
+
subscribe: (observerOrNext?: ObservableObserver<T> | ((value: T) => void), error?: (error: unknown) => void, complete?: () => void) => ObservableSubscription;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
declare type ObservableObserver<T> = {
|
|
217
|
+
next?: (value: T) => void;
|
|
218
|
+
error?: (error: unknown) => void;
|
|
219
|
+
complete?: () => void;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
declare type ObservableSubscription = {
|
|
223
|
+
unsubscribe: () => void;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
declare interface OpenAppParams {
|
|
227
|
+
custom?: {
|
|
228
|
+
name?: string;
|
|
229
|
+
};
|
|
230
|
+
app?: App;
|
|
231
|
+
params?: {
|
|
232
|
+
[key: string]: any;
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export declare interface PlatformConfig {
|
|
237
|
+
theme: 'dark' | 'light';
|
|
238
|
+
language: string;
|
|
239
|
+
appVersion?: string;
|
|
240
|
+
systemVersion: string;
|
|
241
|
+
format: {
|
|
242
|
+
date?: string;
|
|
243
|
+
time?: string;
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export declare interface QueryConfig {
|
|
248
|
+
timer?: boolean;
|
|
249
|
+
observable?: boolean;
|
|
250
|
+
encrypt?: boolean;
|
|
251
|
+
timeout?: number;
|
|
252
|
+
skipPreflight?: boolean;
|
|
253
|
+
autoFailTips?: boolean;
|
|
254
|
+
failTipsPrefix?: string;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export declare type ResponseData<T> = T extends undefined ? ResponseDataBase : ResponseDataBase & T;
|
|
258
|
+
|
|
259
|
+
declare interface ResponseDataBase {
|
|
260
|
+
reqid: string;
|
|
261
|
+
result: ResponseStatus;
|
|
262
|
+
taskId?: string;
|
|
263
|
+
type?: string;
|
|
264
|
+
errmsg?: string;
|
|
265
|
+
errno?: number;
|
|
266
|
+
extra?: string;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
declare enum ResponseStatus {
|
|
270
|
+
SUCCESS = "succ",// 成功
|
|
271
|
+
FAIL = "fail",// 失败
|
|
272
|
+
CANCEL = "cancel",// 用户取消
|
|
273
|
+
DOING = "doing"
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export declare type SessionCredentialsResult = {
|
|
277
|
+
code: 0;
|
|
278
|
+
msg: string;
|
|
279
|
+
data: {
|
|
280
|
+
secret: string;
|
|
281
|
+
token?: string;
|
|
282
|
+
};
|
|
283
|
+
} | {
|
|
284
|
+
code: 1;
|
|
285
|
+
msg: string;
|
|
286
|
+
error: 'NOT_SUPPORTED' | 'FORBIDDEN' | 'SESSION_UNAVAILABLE' | 'CONNECTION_CLOSED';
|
|
287
|
+
data: null;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Trim App 实例类
|
|
292
|
+
*/
|
|
293
|
+
declare class TrimApp {
|
|
294
|
+
private options;
|
|
295
|
+
private flutterInAppWebView;
|
|
296
|
+
private osConnector;
|
|
297
|
+
private initPromise;
|
|
298
|
+
private reconnectPromise?;
|
|
299
|
+
private appApiVersion?;
|
|
300
|
+
private runtime?;
|
|
301
|
+
private getRuntime;
|
|
302
|
+
isWeb: boolean;
|
|
303
|
+
isStandaloneWeb: boolean;
|
|
304
|
+
constructor(options?: TrimAppOptions);
|
|
305
|
+
private init;
|
|
306
|
+
private getWebMethods;
|
|
307
|
+
private loadAppMessage;
|
|
308
|
+
private initMobileAppApi;
|
|
309
|
+
private assertMobileAppApi;
|
|
310
|
+
private isAtLeastVersion;
|
|
311
|
+
private parseVersion;
|
|
312
|
+
callAppMethod<T>(fn: string, ...params: Array<string | undefined>): Promise<T | null>;
|
|
313
|
+
/**
|
|
314
|
+
* 等待初始化完成
|
|
315
|
+
*
|
|
316
|
+
* @returns Promise
|
|
317
|
+
*/
|
|
318
|
+
ready(): Promise<void>;
|
|
319
|
+
/**
|
|
320
|
+
* 初始化失败或未发现宿主后,重新探测 Web 宿主。
|
|
321
|
+
* 已连接的宿主和移动端保持不变;业务请求需由调用方重新发起。
|
|
322
|
+
*/
|
|
323
|
+
reconnectHost(): Promise<void>;
|
|
324
|
+
/** Reads host protocol support, never an application's authorization status. */
|
|
325
|
+
getHostCapabilities(): Promise<HostCapabilities>;
|
|
326
|
+
/** Reads only this official application's Desktop session; never caches credentials. */
|
|
327
|
+
getSessionCredentials(): Promise<SessionCredentialsResult>;
|
|
328
|
+
/**
|
|
329
|
+
* 获取配置
|
|
330
|
+
*/
|
|
331
|
+
getOptions(): TrimAppOptions;
|
|
332
|
+
/**
|
|
333
|
+
* 更新配置
|
|
334
|
+
*/
|
|
335
|
+
setOptions(options: Partial<TrimAppOptions>): void;
|
|
336
|
+
/**
|
|
337
|
+
* 获取平台配置
|
|
338
|
+
*/
|
|
339
|
+
getPlatformConfig(): Promise<PlatformConfig>;
|
|
340
|
+
getHostSnapshot(): Promise<HostSnapshot>;
|
|
341
|
+
getAppAuthBaseUrl(): Promise<string>;
|
|
342
|
+
buildAppAuthUrl<TMethod extends AppAuthMethod>(method: TMethod, params: AppAuthParams<NoInfer<TMethod>>): Promise<string>;
|
|
343
|
+
openAppAuth<TMethod extends AppAuthMethod>(method: TMethod, params: AppAuthParams<NoInfer<TMethod>>, options?: {
|
|
344
|
+
target?: string;
|
|
345
|
+
features?: string;
|
|
346
|
+
}): Promise<string>;
|
|
347
|
+
parseAppAuthCallback(input?: string | URL | URLSearchParams): AppAuthResult;
|
|
348
|
+
openApp(anchor: string): Promise<unknown>;
|
|
349
|
+
/**
|
|
350
|
+
* setTitle - 设置标题
|
|
351
|
+
*
|
|
352
|
+
* @param title 标题文本
|
|
353
|
+
*/
|
|
354
|
+
setTitle(title: string): Promise<void | undefined>;
|
|
355
|
+
/**
|
|
356
|
+
* setExitPageTips - 设置退出页面提示
|
|
357
|
+
*
|
|
358
|
+
* @param params 提示参数
|
|
359
|
+
*/
|
|
360
|
+
setExitPageTips(params?: {
|
|
361
|
+
title?: string;
|
|
362
|
+
content?: string;
|
|
363
|
+
}): Promise<unknown>;
|
|
364
|
+
/**
|
|
365
|
+
* 通过应用打开某个文件
|
|
366
|
+
*/
|
|
367
|
+
openFile(path: string): Promise<unknown>;
|
|
368
|
+
/**
|
|
369
|
+
* 打开文件管理器
|
|
370
|
+
*/
|
|
371
|
+
openFileManager(path: string): Promise<unknown>;
|
|
372
|
+
showFileDetails(paths: string[], options?: FileDetailsOptions): Promise<unknown>;
|
|
373
|
+
authorizeUserFile(path: string): Promise<AppBridgeResponse_2<AuthorizeFileResult> | undefined>;
|
|
374
|
+
authorizeSharedFile(path: string): Promise<AppBridgeResponse_2<AuthorizeFileResult> | undefined>;
|
|
375
|
+
/**
|
|
376
|
+
* 打开当前应用在系统中的应用设置页
|
|
377
|
+
*/
|
|
378
|
+
openAppSetting(): Promise<unknown>;
|
|
379
|
+
/**
|
|
380
|
+
* 打开自定义应用
|
|
381
|
+
*
|
|
382
|
+
* @param appName 自定义应用标识
|
|
383
|
+
* @param options 自定义应用配置和打开参数
|
|
384
|
+
*/
|
|
385
|
+
openCustomApp(appName: string, options: OpenAppParams): Promise<void>;
|
|
386
|
+
/**
|
|
387
|
+
* 打开外部链接 App 端通过系统浏览器打开,Web 端沿用 window.open 行为
|
|
388
|
+
*/
|
|
389
|
+
openURL(url: string, target?: string, features?: string): Promise<unknown>;
|
|
390
|
+
/**
|
|
391
|
+
* 关闭应用
|
|
392
|
+
*/
|
|
393
|
+
close(): Promise<unknown>;
|
|
394
|
+
/**
|
|
395
|
+
* 请求接口
|
|
396
|
+
*/
|
|
397
|
+
query<T>(params: any, config: QueryConfig & {
|
|
398
|
+
observable: true;
|
|
399
|
+
}): Promise<ObservableLike<ResponseData<T>>>;
|
|
400
|
+
query<T>(params: any, config?: QueryConfig): Promise<ResponseData<T>>;
|
|
401
|
+
refreshToken(): Promise<void>;
|
|
402
|
+
/**
|
|
403
|
+
* 监听事件(仅 Web 平台)
|
|
404
|
+
*/
|
|
405
|
+
$on(event: string, cb: (...args: any[]) => void): Promise<void>;
|
|
406
|
+
/**
|
|
407
|
+
* 取消监听事件(仅 Web 平台)
|
|
408
|
+
*/
|
|
409
|
+
$off(event: string, cb: (...args: any[]) => void): Promise<void>;
|
|
410
|
+
/**
|
|
411
|
+
* 监听一次事件(仅 Web 平台)
|
|
412
|
+
*/
|
|
413
|
+
$once(event: string, cb: (...args: any[]) => void): Promise<void>;
|
|
414
|
+
/**
|
|
415
|
+
* 选择文件
|
|
416
|
+
*/
|
|
417
|
+
pickFile(params: FilePickerParams): Promise<string[] | undefined>;
|
|
418
|
+
/**
|
|
419
|
+
* 选择用户文件并授权给当前应用
|
|
420
|
+
*/
|
|
421
|
+
pickUserFile(params?: FilePickerParams): Promise<AppBridgeResponse_2<string[]> | undefined>;
|
|
422
|
+
/**
|
|
423
|
+
* 选择共享文件并授权给当前应用
|
|
424
|
+
*/
|
|
425
|
+
pickSharedFile(params?: Omit<FilePickerParams, 'directory'>): Promise<AppBridgeResponse_2<string[]> | undefined>;
|
|
426
|
+
}
|
|
427
|
+
export { TrimApp }
|
|
428
|
+
export default TrimApp;
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* SDK 配置选项
|
|
432
|
+
*/
|
|
433
|
+
export declare interface TrimAppOptions {
|
|
434
|
+
/**
|
|
435
|
+
* 是否开启 debug 模式,开启后会输出日志
|
|
436
|
+
*/
|
|
437
|
+
debug?: boolean;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export { }
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
declare global {
|
|
444
|
+
interface Window {
|
|
445
|
+
flutter_inappwebview: FlutterInAppWebView;
|
|
446
|
+
fnAppMessage?: (message: string) => void;
|
|
447
|
+
_flutter_onAppObservableQueryResult?: (message: string | MobileObservableQueryResult<any>) => void;
|
|
448
|
+
onAppHeaderGoBack?: () => boolean | number | string;
|
|
449
|
+
}
|
|
144
450
|
}
|
|
145
|
-
export default TrimApp;
|