@edenapp/types 0.1.1 → 0.1.2
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 +15 -1
- package/global.d.ts +11 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,13 +10,27 @@ For Eden app development:
|
|
|
10
10
|
npm install -D @edenapp/types
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
## TypeScript Configuration
|
|
14
|
+
|
|
15
|
+
To enable type support for window APIs, update your `tsconfig.json` to include:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"compilerOptions": {
|
|
20
|
+
"types": [
|
|
21
|
+
"@edenapp/types/global"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
13
27
|
## Usage
|
|
14
28
|
|
|
15
29
|
Import types in your Eden app:
|
|
16
30
|
|
|
17
31
|
```typescript
|
|
18
32
|
// Use Eden API in your app's frontend
|
|
19
|
-
const files = await window.edenAPI
|
|
33
|
+
const files = await window.edenAPI!.shellCommand('fs/readdir', {
|
|
20
34
|
path: '/home/user/documents'
|
|
21
35
|
});
|
|
22
36
|
```
|
package/global.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { CommandName, CommandArgs, CommandResult } from "./commands";
|
|
4
4
|
import type { EventName, EventData } from "./events";
|
|
5
5
|
|
|
6
|
-
interface EdenAPI {
|
|
6
|
+
export interface EdenAPI {
|
|
7
7
|
/**
|
|
8
8
|
* Execute a shell command with type-safe arguments
|
|
9
9
|
* @param command - The command name (e.g., "process/launch")
|
|
@@ -47,9 +47,14 @@ interface EdenAPI {
|
|
|
47
47
|
isEventSupported(event: string): Promise<boolean>;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
declare global {
|
|
51
|
+
interface Window {
|
|
52
|
+
/**
|
|
53
|
+
* Eden API instance available only in renderer processes
|
|
54
|
+
*/
|
|
55
|
+
edenAPI?: EdenAPI;
|
|
56
|
+
}
|
|
55
57
|
}
|
|
58
|
+
|
|
59
|
+
// This export is important - it marks the file as a module
|
|
60
|
+
export {};
|