@pixpilot/chrome-lifecycle 0.1.0 → 0.1.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 +28 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
1
|
# @pixpilot/chrome-lifecycle
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A utility package for managing Chrome extension lifecycle events.
|
|
4
|
+
|
|
5
|
+
## onWindowClose
|
|
6
|
+
|
|
7
|
+
Registers a callback to be executed when a specific Chrome window is closed. This is useful for triggering alerts, saving data, or cleaning up resources when a specific popup or window is removed.
|
|
8
|
+
|
|
9
|
+
### Usage
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { onWindowClose } from '@pixpilot/chrome-lifecycle';
|
|
13
|
+
|
|
14
|
+
const unsubscribe = onWindowClose(windowId, () => {
|
|
15
|
+
console.log('Window was closed!');
|
|
16
|
+
// Perform cleanup or other actions
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Later, to stop listening:
|
|
20
|
+
unsubscribe();
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Parameters
|
|
24
|
+
|
|
25
|
+
- `windowId` (number): The Chrome window ID to watch
|
|
26
|
+
- `callback` (function): Function to execute when the window closes
|
|
27
|
+
|
|
28
|
+
### Returns
|
|
29
|
+
|
|
30
|
+
A function to unsubscribe (remove) the listener.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixpilot/chrome-lifecycle",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "Lifecycle management utilities for Chrome extensions.",
|
|
6
6
|
"author": "m.doaie <m.doaie@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"eslint": "^9.38.0",
|
|
30
30
|
"tsdown": "^0.15.9",
|
|
31
31
|
"typescript": "^5.9.3",
|
|
32
|
-
"@internal/eslint-config": "0.3.0",
|
|
33
32
|
"@internal/prettier-config": "0.1.0",
|
|
34
33
|
"@internal/tsdown-config": "0.1.0",
|
|
35
|
-
"@internal/
|
|
36
|
-
"@internal/tsconfig": "0.1.0"
|
|
34
|
+
"@internal/eslint-config": "0.3.0",
|
|
35
|
+
"@internal/tsconfig": "0.1.0",
|
|
36
|
+
"@internal/vitest-config": "0.1.0"
|
|
37
37
|
},
|
|
38
38
|
"prettier": "@internal/prettier-config",
|
|
39
39
|
"scripts": {
|