@miniben90/x-win 1.5.0 → 1.5.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.
Files changed (2) hide show
  1. package/index.d.ts +86 -0
  2. package/package.json +8 -8
package/index.d.ts CHANGED
@@ -39,8 +39,94 @@ export interface WindowInfo {
39
39
  usage: UsageInfo
40
40
  url: string
41
41
  }
42
+ /**
43
+ * Retrieve information about currently active window.
44
+ * Returns an object of `WindowInfo`.
45
+ *
46
+ * # Example
47
+ * ```javascript
48
+ * const currentWindow = activeWindow();
49
+ * console.log(currentWindow);
50
+ * ```
51
+ *
52
+ * # Information about Electron
53
+ *
54
+ * It is recommended to use this function within a worker to mitigate potential recovery issues on MacOS.
55
+ */
42
56
  export function activeWindow(): WindowInfo
57
+ /**
58
+ * Retrieve information about currently open windows.
59
+ * Returns an array of `WindowInfo`, each containing details about a specific open window.
60
+ *
61
+ * # Example
62
+ * ```javascript
63
+ * const windows = openWindows();
64
+ * for (let i = 0; i < windows.length; i++) {
65
+ * console.log(i, windows[i]);
66
+ * }
67
+ * ```
68
+ *
69
+ * # Information about Electron
70
+ *
71
+ * It is recommended to use this function within a worker to mitigate potential recovery issues on MacOS.
72
+ */
43
73
  export function openWindows(): Array<WindowInfo>
74
+ /**
75
+ * Subscribe an observer thread to monitor changes in the active window.
76
+ *
77
+ * # Example
78
+ * ```javascript
79
+ * const a = subscribeActiveWindow((info) => {
80
+ * t.log(a, info);
81
+ * });
82
+ * const b = subscribeActiveWindow((info) => {
83
+ * t.log(b, info);
84
+ * });
85
+ * const c = subscribeActiveWindow((info) => {
86
+ * t.log(c, info);
87
+ * });
88
+ *
89
+ * unsubscribeAllActiveWindow();
90
+ * ```
91
+ */
44
92
  export function subscribeActiveWindow(callback: (info: WindowInfo) => void): number
93
+ /**
94
+ * Terminate and unsubscribe a specific observer using their ID.
95
+ *
96
+ * # Example
97
+ * ```javascript
98
+ * const a = subscribeActiveWindow((info) => {
99
+ * t.log(a, info);
100
+ * });
101
+ * const b = subscribeActiveWindow((info) => {
102
+ * t.log(b, info);
103
+ * });
104
+ * const c = subscribeActiveWindow((info) => {
105
+ * t.log(c, info);
106
+ * });
107
+ *
108
+ * unsubscribeActiveWindow(a);
109
+ * unsubscribeActiveWindow(b);
110
+ * unsubscribeActiveWindow(c);
111
+ * ```
112
+ */
45
113
  export function unsubscribeActiveWindow(threadId: number): void
114
+ /**
115
+ * Terminate and unsubscribe all observer threads monitoring changes in the active window.
116
+ *
117
+ * # Example
118
+ * ```javascript
119
+ * const a = subscribeActiveWindow((info) => {
120
+ * t.log(a, info);
121
+ * });
122
+ * const b = subscribeActiveWindow((info) => {
123
+ * t.log(b, info);
124
+ * });
125
+ * const c = subscribeActiveWindow((info) => {
126
+ * t.log(c, info);
127
+ * });
128
+ *
129
+ * unsubscribeAllActiveWindow();
130
+ * ```
131
+ */
46
132
  export function unsubscribeAllActiveWindow(): void
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": "1.5.0",
4
+ "version": "1.5.1",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "files": [
@@ -61,12 +61,12 @@
61
61
  },
62
62
  "packageManager": "yarn@4.0.2",
63
63
  "optionalDependencies": {
64
- "@miniben90/x-win-win32-x64-msvc": "1.5.0",
65
- "@miniben90/x-win-darwin-x64": "1.5.0",
66
- "@miniben90/x-win-linux-x64-gnu": "1.5.0",
67
- "@miniben90/x-win-darwin-arm64": "1.5.0",
68
- "@miniben90/x-win-win32-arm64-msvc": "1.5.0",
69
- "@miniben90/x-win-win32-ia32-msvc": "1.5.0",
70
- "@miniben90/x-win-darwin-universal": "1.5.0"
64
+ "@miniben90/x-win-win32-x64-msvc": "1.5.1",
65
+ "@miniben90/x-win-darwin-x64": "1.5.1",
66
+ "@miniben90/x-win-linux-x64-gnu": "1.5.1",
67
+ "@miniben90/x-win-darwin-arm64": "1.5.1",
68
+ "@miniben90/x-win-win32-arm64-msvc": "1.5.1",
69
+ "@miniben90/x-win-win32-ia32-msvc": "1.5.1",
70
+ "@miniben90/x-win-darwin-universal": "1.5.1"
71
71
  }
72
72
  }