assistsx-js 0.0.2019 → 0.0.2021
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.
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export class AccessibilityEventFilter {
|
|
6
6
|
constructor(config = {}) {
|
|
7
|
-
var _a, _b, _c, _d, _e
|
|
7
|
+
var _a, _b, _c, _d, _e;
|
|
8
8
|
this.packageName = (_a = config.packageName) !== null && _a !== void 0 ? _a : null;
|
|
9
9
|
this.processInBackground = (_b = config.processInBackground) !== null && _b !== void 0 ? _b : true;
|
|
10
10
|
this.fetchNodeInfo = (_c = config.fetchNodeInfo) !== null && _c !== void 0 ? _c : true;
|
|
11
11
|
this.enableLogging = (_d = config.enableLogging) !== null && _d !== void 0 ? _d : false;
|
|
12
|
-
this.eventTypes =
|
|
13
|
-
this.enableDeduplication = (
|
|
12
|
+
this.eventTypes = config.eventTypes;
|
|
13
|
+
this.enableDeduplication = (_e = config.enableDeduplication) !== null && _e !== void 0 ? _e : false;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* 检查是否应该处理指定包的事件
|
|
@@ -26,7 +26,9 @@ export class AccessibilityEventFilter {
|
|
|
26
26
|
* @returns true表示应该处理,false表示应该过滤
|
|
27
27
|
*/
|
|
28
28
|
shouldProcessEventType(eventType) {
|
|
29
|
-
|
|
29
|
+
var _a, _b;
|
|
30
|
+
return (this.eventTypes === null ||
|
|
31
|
+
((_b = (_a = this.eventTypes) === null || _a === void 0 ? void 0 : _a.includes(eventType)) !== null && _b !== void 0 ? _b : false));
|
|
30
32
|
}
|
|
31
33
|
/**
|
|
32
34
|
* 创建默认的过滤配置
|
package/package.json
CHANGED
|
@@ -74,7 +74,7 @@ export class AccessibilityEventFilter {
|
|
|
74
74
|
/**
|
|
75
75
|
* 事件类型过滤
|
|
76
76
|
*/
|
|
77
|
-
public readonly eventTypes
|
|
77
|
+
public readonly eventTypes?: number[] | null;
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* 是否启用事件去重
|
|
@@ -86,7 +86,7 @@ export class AccessibilityEventFilter {
|
|
|
86
86
|
this.processInBackground = config.processInBackground ?? true;
|
|
87
87
|
this.fetchNodeInfo = config.fetchNodeInfo ?? true;
|
|
88
88
|
this.enableLogging = config.enableLogging ?? false;
|
|
89
|
-
this.eventTypes = config.eventTypes
|
|
89
|
+
this.eventTypes = config.eventTypes;
|
|
90
90
|
this.enableDeduplication = config.enableDeduplication ?? false;
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -105,7 +105,10 @@ export class AccessibilityEventFilter {
|
|
|
105
105
|
* @returns true表示应该处理,false表示应该过滤
|
|
106
106
|
*/
|
|
107
107
|
public shouldProcessEventType(eventType: number): boolean {
|
|
108
|
-
return
|
|
108
|
+
return (
|
|
109
|
+
this.eventTypes === null ||
|
|
110
|
+
(this.eventTypes?.includes(eventType) ?? false)
|
|
111
|
+
);
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
/**
|