forked from lspriv/wx-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.d.ts
100 lines (90 loc) · 3 KB
/
global.d.ts
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
/*
* Copyright 2023 lspriv. All Rights Reserved.
* Distributed under MIT license.
* See File LICENSE for detail or copy at https://opensource.org/licenses/MIT
* @Description: 声明
* @Author: lspriv
* @LastEditTime: 2024-01-13 13:20:48
*/
declare type SkylineStyleObject = Record<string, string | number>;
interface Shared<T> {
value: T;
}
declare namespace WechatMiniprogram {
interface Worklet {
shared<T>(initialValue: T): Shared<T>;
timing<T>(toValue: T, options: WechatMiniprogram.TimingOption, callback?: (...args: any[]) => any): T;
spring<T>(toValue: T, options: WechatMiniprogram.SpringOption, callback?: (...args: any[]) => any): T;
delay<T>(delayMS: number, delayedAnimation: T): T;
sequence<T>(...args: Array<T>): T;
}
interface WorkletEasing {
in(easing?: Function): any;
out(easing?: Function): any;
inOut(easing?: Function): any;
sin(...args: any[]): any;
bezier(x1: number, y1: number, x2: number, y2: number): any;
}
interface GragGestureEvent<DataSet extends IAnyObject = IAnyObject> {
state: 0 | 1 | 2 | 3 | 4;
absoluteX: number;
absoluteY: number;
deltaX: number;
deltaY: number;
velocityX: number;
velocityY: number;
currentTarget: Target<DataSet>;
}
// interface GragGestureResponseEvent {
// clientX: number;
// clientY: number;
// deltaX: number;
// deltaY: number;
// force: number;
// identifier: number;
// localX: number;
// localY: number;
// radiusX: number;
// radiusY: number;
// rotationAngle: number;
// tilt: number;
// timeStamp: number;
// type: string;
// }
namespace Component {
interface AnimatedUpdater {
(): SkylineStyleObject;
}
interface AnimatedUserConfig {
immediate?: boolean;
flush?: 'async' | 'sync';
}
interface AnimatedResult {
styleId: number;
}
interface InstanceProperties {
renderer?: 'webview' | 'skyline';
applyAnimatedStyle(
selector: string,
updater: AnimatedUpdater,
userConfig?: AnimatedUserConfig,
callback?: (result: AnimatedResult) => void
): void;
clearAnimatedStyle(selector: string, styleIds: Array<number>, callback?: () => void): void;
}
}
}
declare interface HTMLCanvasElement {
/**
* 在下次进行重绘时执行。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
* @param callback 执行的 callback
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.requestAnimationFrame.html
*/
requestAnimationFrame(callback: () => void): number;
/**
* 取消由 requestAnimationFrame 添加到计划中的动画帧请求。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
* @param requestID requestAnimationFrame返回的请求 ID
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.cancelAnimationFrame.html
*/
cancelAnimationFrame(requestID: number): void;
}