-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.d.ts
More file actions
921 lines (814 loc) · 28.1 KB
/
index.d.ts
File metadata and controls
921 lines (814 loc) · 28.1 KB
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
//#region App
declare interface LaunchOptions {
query: any;
path: string;
}
declare type Showoptions = LaunchOptions;
declare interface AppParams {
onLaunch?: (LaunchOptions?: any) => void;
onShow?: (Showoptions?: any) => void;
onHide?: () => void;
onError?: (err: any) => void;
globalData?: {
[props: string]: any;
};
[props: string]: any;
}
declare function App(appParams: AppParams): void;
declare type Appinstance = AppParams;
declare function getApp(): Appinstance;
//#endregion
//#region Page
declare interface PageParams {
data?: { [props: string]: any; } | Function;
onLoad?: (query: any) => void;
onReady?: () => void;
onShow?: () => void;
onHide?: () => void;
onUnload?: () => void;
onTitleClick?: () => void;
onPullDownRefresh?: () => void;
onReachBottom?: () => void;
onShareAppMessage?: () => void;
[props: string]: any;
}
declare function Page(params: PageParams): void;
declare function getCurrentPages(): any;
//#endregion
//#region namespace my
declare namespace my {
export interface Error {
error: number|string;
msg: string;
}
export interface commonParams<T> {
success?: (res?: T) => void;
fail?: (error?: Error | any) => void;
complete?: (res?: any) => void;
[props: string]: any;
}
//#region Navigation Bar
export interface NavigateToParams extends commonParams<null> {
url: string;
}
export function navigateTo(params: NavigateToParams): void;
export type RedirectToParams = NavigateToParams;
export function redirectTo(params: RedirectToParams): void;
export interface NavigateBackParams extends commonParams<null> {
delta: number;
}
export function navigateBack(params: NavigateBackParams): void;
export type RelaunchParams = NavigateToParams;
export function reLaunch(params: RelaunchParams): void;
export interface SetNavigationBarParams extends commonParams<null> {
title?: string;
backgroundColor?: string;
borderBottomColor?: string;
reset?: boolean;
}
export function setNavigationBar(params: SetNavigationBarParams): void;
export function showNavigationBarLoading(): void;
export function hideNavigationBarLoading(): void;
//#endregion
//#region Tab Bar
export type SwitchTabParams = NavigateToParams;
export function switchTab(params: SwitchTabParams): void;
export interface AlertParams extends commonParams<null> {
title?: string;
content?: string;
buttonText?: string;
}
export function alert(params: AlertParams): void;
//#endregion
//#region Interactive feedback
export interface ConfirmSuccess {
confirm: boolean;
}
export interface ConfirmParams extends commonParams<ConfirmSuccess> {
title?: string;
content?: string;
confirmButtonText?: string;
cancelButtonText?: string;
}
export function confirm(params: ConfirmParams): void;
export interface ShowToastParams extends commonParams<null> {
content?: string;
delay?: number;
}
export function showToast(params: ShowToastParams): void;
export function hideToast(): void;
export interface ShowLoadingParams extends commonParams<null> {
type?: string;
content?: string;
duration?: number;
}
export function showLoading(params: ShowLoadingParams): void;
export function hideLoading(): void;
export function showNavigationBarLoading(): void;
export function hideNavigationBarLoading(): void;
export interface ShowActionSheetSuccess {
index: number;
}
export interface ShowActionSheetParams extends commonParams<ShowActionSheetSuccess> {
title?: string;
items: string[];
cancelButtonText?: string;
destructiveBtnIndex: number;
}
export function showActionSheet(params: ShowActionSheetParams): void;
//#endregion
//#region Pull-Refresh
export function onPullDownRefresh(): void;
export function stopPullDownRefresh(): void;
//#endregion
//#region Contact
export interface ChoosePhoneContactSuccess {
name: string;
mobile: string;
}
export type ChoosePhoneContactParams = commonParams<ChoosePhoneContactSuccess>;
export function choosePhoneContact(params: ChoosePhoneContactParams): void;
export interface Contact {
realName: string;
mobile: string;
email: string;
avatar: string;
userId: string;
}
export interface Contacts {
contacts: Contact[];
}
export interface ChooseAlipayContactParams extends commonParams<Contacts>{
count?: number;
}
export function chooseAlipayContact(params: ChooseAlipayContactParams): void;
export interface contactsDic {
userId: string;
avatar: string;
mobile: string;
realName: string;
displayName: string;
}
interface ChooseContactSuccess {
contactsDicArray: contactsDic[];
}
export interface ChooseContactParams extends commonParams<ChooseContactSuccess> {
chooseType: 'single' | 'multi';
includeMobileContactMode?: string;
includeMe?: boolean;
multiChooseMax?: number;
multiChooseMaxTips?: string;
}
export function chooseContact(params: ChooseContactParams): void;
//#endregion
//#region Choose City
export interface City {
city: string;
adCode: string;
spell: string;
}
export interface ChooseCitySuccess {
city: string;
adCode: string;
}
export interface ChooseCityParams extends commonParams<ChooseCitySuccess> {
showLocatedCity?: boolean;
showHotCities?: boolean;
cities?: City[];
hotCities?: City[];
}
export function chooseCity(params: ChooseCityParams): void;
//#endregion
//#region Choose Date
export interface DatePickerSuccess {
date: string;
}
export interface DatePickerParams extends commonParams<DatePickerSuccess> {
format?: 'yyyy-MM-dd' | 'HH:mm' | 'yyyy-MM-dd HH:mm' | 'yyyy-MM' | 'yyyy' | string;
currentDate?: string;
startDate?: string;
endDate?: string;
}
export function datePicker(params: DatePickerParams): void;
//#endregion
//#region Animation
export interface Animation {
opacity(value: number): Animation;
backgroundColor(color: string): Animation;
width(length: number | string): Animation;
height(length: number | string): Animation;
top(length: number | string): Animation;
left(length: number | string): Animation;
bottom(length: number | string): Animation;
right(length: number | string): Animation;
rotate(deg: number): Animation;
rotateX(deg: number): Animation;
rotateY(deg: number): Animation;
rotateZ(deg: number): Animation;
rotate3d(x: number, y: number, z: number): Animation;
scale(sx: number, xy?: number): Animation;
scaleX(sx: number): Animation;
scaleY(sy: number): Animation;
scaleZ(sz: number): Animation;
scale3d(sx: number, sy: number, sz: number): Animation;
translate(sx: number, xy?: number): Animation;
translateX(sx: number): Animation;
translateY(sy: number): Animation;
translateZ(sz: number): Animation;
translate3d(sx: number, sy: number, sz: number): Animation;
skew(ax: number, ay?: number): Animation;
skewX(ax: number): Animation;
skewY(ay: number): Animation;
matrix(a: number, b: number, c: number, d: number, tx: number, ty: number): Animation;
matrix3d(...arg: any[]): Animation;
export(): any;
}
export interface AnimationOptions {
duration?: number;
timingFunction?: "linear" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-start" | "step-end" | string;
delay?: number;
transformOrigin?: string;
}
export function createAnimation(params: AnimationOptions): Animation;
//endregion
//#region Canvas
export interface ToTempFilePathParams extends commonParams<string> {
x?: number;
y?: number;
width?: number;
height?: number;
destWidth?: number;
destHeight?: number;
}
export interface CanvasContext {
toTempFilePath(params: ToTempFilePathParams): void;
setTextAlign(params: "left" | "right" | "center" | "start" | "end" | string): void;
setTextBaseline(params: "top" | "hanging" | "middle" | "alphabetic" | "ideographic" | "bottom" | string): void;
setFillStyle(color: string): void;
setStrokeStyle(color: string): void;
setShadow(offsetX: number, offsetY: number, blur: number, color: string): void;
createLinearGradient(x0: number, y0: number, x1: number, y1: number): void;
createCircularGradient(x: number, y: number, r: number): void;
addColorStop(stop: number, color: string): void;
setLineWidth(lineWidth: number): void;
setLineCap(lineCap: 'round' | 'butt' | 'square' | string): void;
setLineJoin(lineJoin: 'round' | 'bevel' | 'miter' | string): void;
setMiterLimit(miterLimit: number): void;
rect(x: number, y: number, width: number, height: number): void;
fillRect(x: number, y: number, width: number, height: number): void;
strokeRect(x: number, y: number, width: number, height: number): void;
clearRect(x: number, y: number, width: number, height: number): void;
fill(): void;
stroke(): void;
beginPath(): void;
closePath(): void;
moveTo(x: number, y: number): void;
lineTo(x: number, y: number): void;
arc(x: number, y: number, r: number, sAngle: number, eAngle: number, counterclockwise: boolean): void;
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
clip(): void;
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
scale(scaleWidth: number, scaleHeight: number): void;
rotate(rotate: number): void;
translate(x: number, y: number): void;
setFontSize(fontSize: number): void;
fillText(text: string, x: number, y: number): void;
drawImage(imageResource: string, x: number, y: number, width: number, height: number): void;
setGlobalAlpha(alpha: number): void;
save(): void;
restore(): void;
draw(reserve?: boolean): void;
}
export function createCanvasContext(canvasId: String): CanvasContext;
//#endregion
//#region Map
export interface GetCenterLocationSuccess {
longitude: string;
latitude: string;
}
export interface MapContext {
getCenterLocation(obj: commonParams<GetCenterLocationSuccess>): void;
moveToLocation(): void;
}
export function createMapContext(mapId: string): MapContext;
//#endregion
//#region KeyBoard
export function hideKeyboard(): void;
//#endregion
//#region Scroll
export function pageScrollTo(params: { scrollTop: number }): void;
//#endregion
//#region Nodes Query
export interface SelectorQuery {
select(selector: string): SelectorQuery;
selectAll(selector: string): SelectorQuery;
selectViewport(): SelectorQuery;
boundingClientRect(): SelectorQuery;
scrollOffset(): SelectorQuery;
exec(callback: Function): void;
}
export function createSelectorQuery(params?: any): SelectorQuery;
//#endregion
//#region User Authorization
export interface GetAuthCodeSuccess {
authCode: string;
authErrorScope: any;
authSucessScope: any[];
}
export type Scope = 'auth_base' | 'auth_user' | 'auth_zhima';
export interface GetAuthCodeParams extends commonParams<GetAuthCodeSuccess> {
scopes: Scope | Scope[];
}
export function getAuthCode(params: GetAuthCodeParams): void;
//#endregion
//#region Client User Info
export interface GetAuthUserInfoSuccess {
nickName: string;
avatar: string;
}
export function getAuthUserInfo(params: commonParams<GetAuthUserInfoSuccess>): void;
//#endregion
//#region Launch Pay Action
export interface TradePaySuccess {
resultCode: string;
}
export interface TradePayParams extends commonParams<TradePaySuccess> {
orderStr?: string;
tradeNO?: string;
}
export function tradePay(params: TradePayParams): void;
//#endregion
//#region Card List
export function openCardList(): void;
export function openMerchantCardList(params: { partnerId: string }): void;
export function openCardDetail(params: { passId: string }): void;
export function openVoucherList(): void;
export function openMerchantVoucherList(params: { partnerId: string }): void;
export interface OpenVoucherDetailParams {
passId?: string;
partnerId?: string;
serialNumber?: string;
}
export function openVoucherDetail(params: OpenVoucherDetailParams): void;
export type OpenKBVoucherDetailParams = OpenVoucherDetailParams
export function openKBVoucherDetail(params: OpenKBVoucherDetailParams): void;
export function openTicketList(): void;
export function openMerchantTicketList(params: { partnerId: string }): void;
export type OpenTicketDetailParams = OpenVoucherDetailParams;
export function openTicketDetail(params: OpenTicketDetailParams): void;
//#endregion
//#region Card Auth
export interface AddCardAuthSuccessResult {
app_id: string;
auth_code: string;
state: string;
scope: string;
template_id: string;
request_id: string;
out_string: string;
}
export interface AddCardAuthSuccess {
success: boolean;
resultStatus?: string;
result?: AddCardAuthSuccessResult;
code?: string;
}
export interface AddCardAuthParams extends commonParams<AddCardAuthSuccess> {
url: string;
}
export function addCardAuth(params: AddCardAuthParams): void;
//#endregion
//#region ZM verify
export interface StartZMVerifySuccess {
bizNo: string;
passed: string;
failed_reason: string;
}
export interface StartZMVerifyParams extends commonParams<StartZMVerifySuccess> {
bizNo: string;
}
export function startZMVerify(params: StartZMVerifyParams): void;
//endregion
//#region ZM Credit Borrow
export interface ZmCreditBorrowSuccess {
invoke_state: string;
out_order_no: string;
order_no: string;
admit_state: string;
user_id: string;
resultStatus: string;
}
export interface ZmCreditBorrowParams extends commonParams<ZmCreditBorrowSuccess> {
out_order_no: string;
product_code: string;
goods_name: string;
rent_unit: string;
rent_amount: string;
deposit_amount: string;
deposit_state: string;
invoke_return_url: string;
invoke_type: 'TINYAPP' | 'WINDOWS';
credit_biz: string;
borrow_time?: string;
expiry_time?: string;
mobile_no?: string;
borrow_shop_name?: string;
rent_settle_type?: string;
invoke_state?: string;
rent_info?: string;
name?: string;
cert_no?: string;
address?: string;
}
export function zmCreditBorrow(params: ZmCreditBorrowParams): void;
//#endregion
//#region Text Risk Identification
interface TextRiskIdentificationSuccess {
result: {
type: '0' | '1' | '2',
hitKeywords?: string[],
score?: string;
};
}
export interface TextRiskIdentificationParams extends commonParams<TextRiskIdentificationSuccess> {
content: string;
type: ('0' | '1' | '2')[];
}
export function textRiskIdentification(params: TextRiskIdentificationParams): void;
//#endregion
//#region Choose Address
interface ChooseAddressSuccess {
addressId: string;
}
export function chooseAddress(params: commonParams<ChooseAddressSuccess>): void;
//#region
//#region MiniProgram Navigate
export interface NavigateToMiniProgramParams extends commonParams<null> {
appId: string;
path: string;
extraData?: any;
}
export function navigateToMiniProgram(params: NavigateToMiniProgramParams): void;
export interface NavigateBackMiniProgram extends commonParams<null> {
extraData?: any;
}
export function navigateBackMiniProgram(params: NavigateBackMiniProgram): void;
//#endregion
//#region Image
export type Source = 'camera' | 'album';
export interface ChooseImageSuccess {
apFilePaths: string[];
}
export interface ChooseImageParams extends commonParams<ChooseImageSuccess> {
count?: number;
sourceType: Source[]
}
export function chooseImage(params: ChooseImageParams): void;
export interface PreviewImageParams extends commonParams<null> {
urls: string[];
current?: number;
}
export function previewImage(params: PreviewImageParams): void;
export interface SaveImageParams extends commonParams<null> {
url: string;
showActionSheet?: boolean;
}
export function saveImage(params: SaveImageParams): void;
//#endregion
//#region Cache
export interface SetStorageParams extends commonParams<null> {
key: string;
data: any;
}
export function setStorage(params: SetStorageParams): void;
export function setStorageSync(params: { key: string, data: any }): void;
export interface GetStorageSuccess {
data: any;
}
export interface GetStorageParams extends commonParams<GetStorageSuccess> {
key: string;
}
export function getStorage(params: GetStorageParams): void;
export function getStorageSync(params: { key: string }): GetStorageSuccess;
export interface RemoveStorageParams extends commonParams<null> {
key: string;
}
export function removeStorage(params: RemoveStorageParams): void;
export function removeStorageSync(params: { key: string }): void;
export function clearStorage(): void;
export function clearStorageSync(): void;
export interface GetStorageInfoSuccess {
keys: string[];
currentSize: number;
limitSize: number;
}
export function getStorageInfo(params: commonParams<GetStorageInfoSuccess>): void;
export type getStorageInfoSyncSuccess = GetStorageInfoSuccess;
export function getStorageInfoSync(): getStorageInfoSyncSuccess;
//#endregion
//#region File
export interface SaveFileSuccess {
apFilePath: string;
}
export interface SaveFileParams extends commonParams<SaveFileSuccess> {
apFilePath: string;
}
export interface GetSavedFileInfoSuccess {
size: number;
createTime: number;
}
export interface GetSavedFileInfoParams extends commonParams<GetSavedFileInfoSuccess> {
apFilePath: string;
}
export function saveFile(params: SaveFileParams): void;
export function getSavedFileInfo(params: GetSavedFileInfoParams);
export interface File {
size: number;
createTime: number;
apFilePath: string;
}
export interface GetSavedFileListSuccess {
fileList: File[];
}
export function getSavedFileList(params: commonParams<GetSavedFileListSuccess>): void;
export interface RemoveSavedFileParams extends commonParams<null> {
apFilePath: string;
}
export function removeSavedFile(params: commonParams<RemoveSavedFileParams>): void;
//#endregion
//#region Location
export interface GetLocationSuccess {
longitude: string;
latitude: string;
accuracy: string;
horizontalAccuracy: string;
country: string;
countryCode: string;
province: string;
city: string;
cityAdcode: string;
district: string;
districtAdcode: string;
streetNumber: any;
pois: any;
}
export interface GetLocationParams extends commonParams<GetLocationSuccess> {
cacheTimeout?: number;
type?: 1 | 2 | 3;
}
export function getLocation(params: GetLocationParams): void;
export interface OpenLocationParams extends commonParams<null> {
longitude: string;
latitude: string;
name: string;
address: string;
scale?: number;
}
export function openLocation(params: OpenLocationParams): void;
//#endregion
//#region Network
export interface HttpRequestSuccess {
data: string | any;
status: number;
headers: any;
}
export interface HttpRequestParams extends commonParams<HttpRequestSuccess> {
url: string;
headers?: any;
method?: string;
data?: any;
timeout?: number;
dataType?: 'json' | 'text' | 'base64';
}
export function httpRequest(params: HttpRequestParams): void;
export type UploadFileSuccess = HttpRequestSuccess;
export interface UploadFileParams extends commonParams<UploadFileSuccess> {
url: string;
filePath: string;
fileName: string;
fileType: 'image' | 'video' | 'audio' | string;
header?: any;
formData?: any;
}
export function uploadFile(params: UploadFileParams): void;
export interface DownloadFileSuccess {
apFilePath: string;
}
export interface DownloadFileParams extends commonParams<DownloadFileSuccess> {
url: string;
header?: any;
}
export function downloadFile(params: DownloadFileParams): void;
export interface ConnectSocketParams extends commonParams<null> {
url: string;
data?: any;
header?: any
}
export function connectSocket(params: ConnectSocketParams): void;
export type Callback<T> = (res: T) => void;
export function onSocketOpen(callback: Callback<any>): void;
export function offSocketOpen(): void;
export function onSocketError(callback: Callback<any>): void;
export function offSocketError(): void;
export function offSocketMessage(): void;
export function onSocketClose(callback: Callback<null>): void;
export function offSocketClose(): void;
export interface SendSocketMessageParams extends commonParams<null> {
data: string | ArrayBuffer;
}
export function sendSocketMessage(params: SendSocketMessageParams): void;
export function onSocketMessage(callback: Callback<{ data: string | ArrayBuffer }>): void;
export function closeSocket(): void;
//#endregion
//#region Device
export const SDKVersion: any;
export function canIUse(key: string): boolean;
export interface getSystemInfoSuccess {
model: string;
pixelRatio: number;
windowWidth: number;
windowHeight: number;
language: string;
version: string;
storage: string;
currentBattery: string;
system: string;
platform: string;
screeWidth: number;
screenHeight: number;
}
export function getSystemInfo(params: commonParams<getSystemInfoSuccess>): void;
export type GetSystemInfoSyncResult = getSystemInfoSuccess;
export function getSystemInfoSync(): GetSystemInfoSyncResult;
export interface GetNetworkTypeSuccess {
networkAvailable: boolean;
networkType: string;
}
export function getNetworkType(params: commonParams<GetNetworkTypeSuccess>): void;
export interface GetClipboardSuccess {
text: string;
}
export function getClipboard(params: commonParams<GetClipboardSuccess>): void;
export interface SetClipboardParams extends commonParams<null> {
text: string;
}
export function setClipboard(params: SetClipboardParams): void;
export function watchShake(params: commonParams<null>): void;
export function vibrate(params: commonParams<null>): void;
export interface makePhoneCallParams extends commonParams<null> {
number: number;
}
export function makePhoneCall(params: makePhoneCallParams): void;
export interface GetServerTimeSuccess {
time: number;
}
export function getServerTime(params: commonParams<GetServerTimeSuccess>): void;
export function onUserCaptureScreen(callback: Callback<null>): void;
export function offUserCaptureScreen(): void;
export interface setKeepScreenOnParams extends commonParams<null> {
keepScreenOn: boolean;
}
export function setKeepScreenOn(params: setKeepScreenOnParams): void;
export function getScreenBrightness(params: commonParams<any>): void;
export interface SetScreenBrightnessParams extends commonParams<any> {
brightness: number;
}
export function setScreenBrightness(params: SetScreenBrightnessParams): void;
//#endregion
//#region Scan Code
export interface ScanSuccess {
code: string;
qrCode?: string;
barCode?: string;
}
export interface ScanParams extends commonParams<ScanSuccess> {
type: 'qr' | 'bar';
}
export function scan(params: ScanParams): void;
//#endregion
//region Data Safe
export interface RsaSuccess {
text: string;
}
export interface RsaParams extends commonParams<RsaSuccess> {
action: 'encrypy' | 'decrypt';
text: string;
key: string;
}
export function rsa(params: RsaParams): void;
//endregion
//region Custom Analytic
export function reportAnalytics(eventName: string, data: any): void;
//#endregion
//region Bluetooth
export interface OpenBluetoothAdapterSuccess {
isSupportBLE: boolean;
}
export interface OpenBluetoothAdapterParams extends commonParams<OpenBluetoothAdapterSuccess> {
autoClose?: boolean;
}
export function openBluetoothAdapter(params: OpenBluetoothAdapterParams): void;
export function closeBluetoothAdapter(pramsn: commonParams<null>): void;
export interface GetBluetoothAdapterStateSuccess {
discovering: boolean;
available: boolean;
}
export function getBluetoothAdapterState(params: commonParams<GetBluetoothAdapterStateSuccess>): void;
export interface StartBluetoothDevicesDiscoveryParams extends commonParams<null> {
services?: string[];
allowDuplicatesKey?: boolean;
interval?: number;
}
export function startBluetoothDevicesDiscovery(params: StartBluetoothDevicesDiscoveryParams): void;
export function stopBluetoothDevicesDiscovery(params: commonParams<null>): void;
export interface Device {
name: string;
deviceName: string;
localName: string;
deviceId: string;
RSSI: number;
advertisData: string;
manufacturerData: string;
}
export interface GetBluetoothDevicesSuccess {
devices: Device[];
}
export function getBluetoothDevices(params: commonParams<GetBluetoothDevicesSuccess>): void;
export type GetConnectedBluetoothDevicesSuccess = GetBluetoothDevicesSuccess;
export interface GetConnectedBluetoothDevicesParams extends commonParams<GetConnectedBluetoothDevicesSuccess> {
services: string[];
}
export function getConnectedBluetoothDevices(params: GetConnectedBluetoothDevicesParams): void;
export interface ConnectBLEDeviceParams extends commonParams<null> {
deviceId: string;
}
export function connectBLEDevice(params: ConnectBLEDeviceParams): void;
export type DisconnectBLEDeviceParams = ConnectBLEDeviceParams;
export function disconnectBLEDevice(params: DisconnectBLEDeviceParams): void;
export interface WriteBLECharacteristicValueParams extends commonParams<null> {
deviceId: string;
serviceId: string;
characteristicId: string;
value: string;
}
export function writeBLECharacteristicValue(params: WriteBLECharacteristicValueParams): void;
export interface Characteristic {
characteristicId: string;
serviceId: string;
value: string;
}
export interface ReadBLECharacteristicValueParams extends commonParams<Characteristic> {
deviceId: string;
serviceId: string;
characteristicId: string;
}
export function readBLECharacteristicValue(params: ReadBLECharacteristicValueParams): void;
export interface NotifyBLECharacteristicValueChangeParams extends commonParams<null> {
deviceId: string;
serviceId: string;
characteristicId: string;
descriptorId?: string;
state?: boolean;
}
export function notifyBLECharacteristicValueChange(params: NotifyBLECharacteristicValueChangeParams): void;
export interface Service {
serviceId: string;
isPrimary: boolean;
}
export interface GetBLEDeviceServicesParams extends commonParams<Service> {
deviceId: string;
}
export function getBLEDeviceServices(params: GetBLEDeviceServicesParams): void;
export interface GetBLEDeviceCharacteristicsDetail extends Characteristic {
properties: {
read: boolean;
write: boolean;
notify: boolean;
indicate: boolean;
};
}
export interface GetBLEDeviceCharacteristicsSuccess {
characteristics: GetBLEDeviceCharacteristicsDetail[];
}
export interface GetBLEDeviceCharacteristicsParams extends commonParams<GetBLEDeviceCharacteristicsSuccess> {
deviceId: string;
serviceId: string;
}
export function getBLEDeviceCharacteristics(params: GetBLEDeviceCharacteristicsParams): void;
export function onBluetoothDeviceFound(callback: Callback<{ devices: Device[] }>): void;
export function offBluetoothDeviceFound(): void;
export interface BLECharacteristicValueChange {
deviceId: string;
serviceId: string;
characteristicId: string;
value: string;
}
export function onBLECharacteristicValueChange(callback: Callback<BLECharacteristicValueChange>): void;
export function offBLECharacteristicValueChange(): void;
export function onBLEConnectionStateChanged(callback: Callback<{ deviceId: string; connected: boolean; }>): void;
export function offBLEConnectionStateChanged(): void;
export function onBluetoothAdapterStateChange(callback: Callback<{ available: boolean; discovering: boolean; }>): void;
export function offBluetoothAdapterStateChange(): void;
//endregion
}
//#endregion