macos-scroll-monitor 1.0.0 → 1.0.1
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 +1 -0
- package/index.d.ts +34 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This module only works in electron, not works in nodejs!
|
package/index.d.ts
CHANGED
|
@@ -1 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 滚动事件数据结构
|
|
3
|
+
*/
|
|
4
|
+
export interface ScrollEvent {
|
|
5
|
+
/** 滚动偏移量。正值向上/向左,负值向下/向右 */
|
|
6
|
+
deltaY: number;
|
|
7
|
+
/** Command (⌘) 键是否按下 */
|
|
8
|
+
command: boolean;
|
|
9
|
+
/** Shift (⇧) 键是否按下 */
|
|
10
|
+
shift: boolean;
|
|
11
|
+
/** Option (⌥) 键是否按下 */
|
|
12
|
+
option: boolean;
|
|
13
|
+
/** Control (⌃) 键是否按下 */
|
|
14
|
+
ctrl: boolean;
|
|
15
|
+
/** Function (fn) 键是否按下 */
|
|
16
|
+
fn: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 回调函数类型定义
|
|
21
|
+
*/
|
|
22
|
+
export type ScrollCallback = (event: ScrollEvent) => void;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 启动全局滚动监听
|
|
26
|
+
* @param callback 每次滚动时触发的回调函数
|
|
27
|
+
* @returns 启动成功返回 true,如果已在运行则返回 undefined 或 false
|
|
28
|
+
*/
|
|
29
|
+
export function start(callback: ScrollCallback): boolean | undefined;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 停止全局滚动监听并释放原生资源
|
|
33
|
+
*/
|
|
34
|
+
export function stop(): void;
|