@bettergi/types 0.1.8 → 0.1.9

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/index.d.ts CHANGED
@@ -19,9 +19,6 @@
19
19
  // 消息通知
20
20
  /// <reference path="./objects/notification.d.ts" />
21
21
 
22
- // 键鼠回调
23
- /// <reference path="./objects/keyMouseHook.d.ts" />
24
-
25
22
  // 任务调用
26
23
  /// <reference path="./objects/dispatcher.d.ts" />
27
24
 
@@ -59,5 +56,8 @@
59
56
  /// <reference path="./types/BetterGenshinImpact/GameTask/AutoDomain/AutoDomainParam.d.ts" />
60
57
  /// <reference path="./types/BetterGenshinImpact/GameTask/AutoFight/AutoFightParam.d.ts" />
61
58
 
59
+ // 键鼠回调
60
+ /// <reference path="./types/BetterGenshinImpact/Core/Script/Dependence/KeyMouseHook.d.ts" />
61
+
62
62
  /// 设置
63
63
  /// <reference path="./objects/settings.d.ts" />
@@ -44,7 +44,7 @@ declare global {
44
44
  * @param callback 回调函数
45
45
  * @param interval 回调节流间隔(单位:毫秒,默认值:200)
46
46
  */
47
- function onMouseMove(callback: (x: number, y: number) => void, interval: number = 200): void;
47
+ function onMouseMove(callback: (x: number, y: number) => void, interval?: number): void;
48
48
 
49
49
  /**
50
50
  * 注册鼠标滚轮事件回调
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bettergi/types",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "BetterGI TypeScript 类型定义",
5
5
  "type": "module",
6
6
  "author": "Bread Grocery<https://github.com/breadgrocery>",
@@ -0,0 +1,76 @@
1
+ import { type KeyCodeString, type KeyDataString } from "../../../../System/Windows/Forms/Keys";
2
+
3
+ type MouseButton = "Left" | "Right" | "Middle" | "XButton1" | "XButton2";
4
+
5
+ declare global {
6
+ namespace BetterGenshinImpact.Core.Script.Dependence {
7
+ class KeyMouseHook {
8
+ /**
9
+ * 注册键盘按下事件回调
10
+ * @param callback 回调函数
11
+ * @param useCodeOnly 是否仅返回 KeyCode,否则返回 KeyData(默认为 true)
12
+ * @since 0.55.0
13
+ */
14
+ onKeyDown(callback: (keyCode: KeyCodeString) => void, useCodeOnly?: true): void;
15
+ // overload
16
+ onKeyDown(callback: (keyData: KeyDataString) => void, useCodeOnly: false): void;
17
+
18
+ /**
19
+ * 注册键盘释放事件回调
20
+ * @param callback 回调函数
21
+ * @param useCodeOnly 是否仅返回 KeyCode,否则返回 KeyData(默认为 true)
22
+ * @since 0.55.0
23
+ */
24
+ onKeyUp(callback: (keyCode: KeyCodeString) => void, useCodeOnly?: true): void;
25
+ // overload
26
+ onKeyUp(callback: (keyData: KeyDataString) => void, useCodeOnly: false): void;
27
+
28
+ /**
29
+ * 注册鼠标移动事件回调
30
+ * @param callback 回调函数
31
+ * @since 0.55.0
32
+ */
33
+ onMouseDown(callback: (button: MouseButton) => void): void;
34
+
35
+ /**
36
+ * 注册鼠标释放事件回调
37
+ * @param callback 回调函数
38
+ * @since 0.55.0
39
+ */
40
+ onMouseUp(callback: (keyCode: MouseButton) => void): void;
41
+
42
+ /**
43
+ * 注册鼠标移动事件回调
44
+ * @param callback 回调函数
45
+ * @param interval 回调节流间隔(单位:毫秒,默认值:200)
46
+ */
47
+ onMouseMove(callback: (x: number, y: number) => void): void;
48
+ // overload
49
+ onMouseMove(callback: (x: number, y: number) => void, interval: number): void;
50
+
51
+ /**
52
+ * 注册鼠标滚轮事件回调
53
+ * @param callback 回调函数
54
+ * @since 0.55.0
55
+ */
56
+ onMouseWheel(callback: (delta: number, x: number, y: number) => void): void;
57
+
58
+ /**
59
+ * 清空回调列表
60
+ * @since 0.55.0
61
+ */
62
+ removeAllListeners(): void;
63
+
64
+ /**
65
+ * 取消所有注册键鼠事件回调
66
+ * @since 0.55.0
67
+ */
68
+ dispose(): void;
69
+
70
+ constructor();
71
+ }
72
+ }
73
+ export import KeyMouseHook = BetterGenshinImpact.Core.Script.Dependence.KeyMouseHook;
74
+ }
75
+
76
+ export {};