@miniben90/x-win 2.0.0 → 2.1.0

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.
Files changed (3) hide show
  1. package/README.md +13 -0
  2. package/index.d.ts +9 -1
  3. package/package.json +54 -5
package/README.md CHANGED
@@ -272,6 +272,19 @@ It will use AppleScript to get informations for chromium browsers and safari
272
272
 
273
273
  * To prevent potential crashes and issues, it's recommended to execute recovery operations within a worker thread ([https://nodejs.org/api/worker_threads.html](https://nodejs.org/api/worker_threads.html))
274
274
  * For macOS, you can utilize functions to check and request screen permissions ([https://www.electronjs.org/fr/docs/latest/api/system-preferences](https://www.electronjs.org/fr/docs/latest/api/system-preferences))
275
+ * When building your application, it’s important to specify all optional packages to be moved to `asar.unpack` to prevent issues during the signing process. [https://www.electronforge.io/config/plugins/auto-unpack-natives](https://www.electronforge.io/config/plugins/auto-unpack-natives) [https://www.electron.build/app-builder-lib.interface.configuration#asarunpack](https://www.electron.build/app-builder-lib.interface.configuration#asarunpack)
276
+
277
+ ### Questions
278
+
279
+ * Why can't I find optional dependencies when I build my application?
280
+
281
+ When setting up CI/CD to build your application, it's important to enforce the installation of sub-packages for each system to prevent any missing components.
282
+
283
+ examples:
284
+
285
+ * `npm install --save-dev @miniben90/x-win-win32-x64-msvc @miniben90/x-win-win32-ia32-msvc @miniben90/x-win-win32-arm64-msvc --ignore-platform --ignore-engines` for win32 system
286
+ * `npm install --save-dev @miniben90/x-win-darwin-arm64 @miniben90/x-win-darwin-universal @miniben90/x-win-darwin-x64 --ignore-platform --ignore-engines` for Darwin system
287
+ * `npm install --save-dev @miniben90/x-win-linux-x64-gnu @miniben90/x-win-linux-x64-musl4 --ignore-platform --ignore-engines` for Linux system
275
288
 
276
289
  <hr class="padding-top: 30px;padding-bottom:30px">
277
290
 
package/index.d.ts CHANGED
@@ -168,6 +168,8 @@ export declare function openWindows(): Array<WindowInfo>
168
168
  export declare function openWindowsAsync(): Promise<Array<WindowInfo>>
169
169
  /**
170
170
  * Subscribe an observer thread to monitor changes in the active window.
171
+ * @param {function} callback - Callback function that returns the active window when it changes
172
+ * @param {number} [interval=100] - Interval between checks for changes in the active window (default: 100ms)
171
173
  *
172
174
  * # Example
173
175
  *
@@ -185,6 +187,9 @@ export declare function openWindowsAsync(): Promise<Array<WindowInfo>>
185
187
  * const c = subscribeActiveWindow((info) => {
186
188
  * t.log(c, info);
187
189
  * });
190
+ * const d = subscribeActiveWindow((info) => {
191
+ * t.log(c, info);
192
+ * },500);// sleep interval: 500ms
188
193
  *
189
194
  * unsubscribeAllActiveWindow();
190
195
  * ```
@@ -203,12 +208,15 @@ export declare function openWindowsAsync(): Promise<Array<WindowInfo>>
203
208
  * const c = subscribeActiveWindow((info) => {
204
209
  * t.log(c, info);
205
210
  * });
211
+ * const d = subscribeActiveWindow((info) => {
212
+ * t.log(c, info);
213
+ * },500);// sleep interval: 500ms
206
214
  *
207
215
  * unsubscribeAllActiveWindow();
208
216
  * ```
209
217
  *
210
218
  */
211
- export declare function subscribeActiveWindow(callback: (info: WindowInfo) => void): number
219
+ export declare function subscribeActiveWindow(callback: (info: WindowInfo) => void, interval?: number): number
212
220
  /**
213
221
  * Terminate and unsubscribe a specific observer using their ID.
214
222
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@miniben90/x-win",
3
3
  "description": "This package allows you to retrieve precise information about active and open windows on Windows, MacOS, and Linux. You can obtain the position, size, title, and other memory of windows.",
4
- "version": "2.0.0",
4
+ "version": "2.1.0",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "files": [
@@ -10,12 +10,27 @@
10
10
  "README.md",
11
11
  "LICENSE"
12
12
  ],
13
+ "napi": {
14
+ "name": "x-win",
15
+ "triples": {
16
+ "additional": [
17
+ "aarch64-apple-darwin",
18
+ "aarch64-pc-windows-msvc",
19
+ "i686-pc-windows-msvc",
20
+ "universal-apple-darwin",
21
+ "x86_64-unknown-linux-musl"
22
+ ]
23
+ }
24
+ },
13
25
  "author": {
14
26
  "name": "BENKHADRA Hocine",
15
27
  "email": "contact@benkhadra.com",
16
28
  "url": "https://benkhadra.com/"
17
29
  },
18
- "repository": "https://github.com/miniben-90/x-win.git",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/miniben-90/x-win.git"
33
+ },
19
34
  "license": "MIT",
20
35
  "keywords": [
21
36
  "active",
@@ -29,12 +44,46 @@
29
44
  "list",
30
45
  "open"
31
46
  ],
47
+ "devDependencies": {
48
+ "@napi-rs/cli": "^2.18.4",
49
+ "ava": "6.2.0",
50
+ "husky": "^9.1.7"
51
+ },
52
+ "ava": {
53
+ "timeout": "3m",
54
+ "failFast": true,
55
+ "files": [
56
+ "__test__/**/*.mjs"
57
+ ]
58
+ },
32
59
  "engines": {
33
60
  "node": ">= 14"
34
61
  },
62
+ "scripts": {
63
+ "artifacts": "napi artifacts",
64
+ "build": "napi build --platform --release",
65
+ "build:debug": "napi build --platform",
66
+ "prepublishOnly": "napi prepublish -t npm",
67
+ "test": "ava",
68
+ "universal": "napi universal",
69
+ "version": "napi version",
70
+ "prepare": "husky",
71
+ "lint:rs": "cd ./x-win-rs && cargo fmt -- --check",
72
+ "lint:napi": "cargo fmt -- --check",
73
+ "lint": "yarn lint:rs && yarn lint:napi",
74
+ "clippy:rs": "cd ./x-win-rs && cargo clippy -- -D warnings",
75
+ "clippy:napi": "cargo clippy -- -D warnings",
76
+ "clippy": "yarn clippy:rs && yarn clippy:napi"
77
+ },
78
+ "packageManager": "yarn@4.5.0",
35
79
  "optionalDependencies": {
36
- "@miniben90/x-win-win32-x64-msvc": "2.0.0",
37
- "@miniben90/x-win-darwin-x64": "2.0.0",
38
- "@miniben90/x-win-linux-x64-gnu": "2.0.0"
80
+ "@miniben90/x-win-win32-x64-msvc": "2.1.0",
81
+ "@miniben90/x-win-darwin-x64": "2.1.0",
82
+ "@miniben90/x-win-linux-x64-gnu": "2.1.0",
83
+ "@miniben90/x-win-darwin-arm64": "2.1.0",
84
+ "@miniben90/x-win-win32-arm64-msvc": "2.1.0",
85
+ "@miniben90/x-win-win32-ia32-msvc": "2.1.0",
86
+ "@miniben90/x-win-darwin-universal": "2.1.0",
87
+ "@miniben90/x-win-linux-x64-musl": "2.1.0"
39
88
  }
40
89
  }