-
-
Notifications
You must be signed in to change notification settings - Fork 913
Expand file tree
/
Copy pathwaveenvimpl.ts
More file actions
42 lines (39 loc) · 1.16 KB
/
waveenvimpl.ts
File metadata and controls
42 lines (39 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2026, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
import { ContextMenuModel } from "@/app/store/contextmenu";
import {
atoms,
createBlock,
getBlockMetaKeyAtom,
getConnStatusAtom,
getSettingsKeyAtom,
isDev,
WOS,
} from "@/app/store/global";
import { RpcApi } from "@/app/store/wshclientapi";
import { WaveEnv } from "@/app/waveenv/waveenv";
import { isMacOS, isWindows, PLATFORM } from "@/util/platformutil";
const configAtoms = new Proxy({} as WaveEnv["configAtoms"], {
get<K extends keyof SettingsType>(_target: WaveEnv["configAtoms"], key: K) {
return getSettingsKeyAtom(key);
},
});
export function makeWaveEnvImpl(): WaveEnv {
return {
electron: (window as any).api,
rpc: RpcApi,
platform: PLATFORM,
configAtoms,
isDev,
isWindows,
isMacOS,
atoms,
createBlock,
showContextMenu: (menu: ContextMenuItem[], e: React.MouseEvent) => {
ContextMenuModel.getInstance().showContextMenu(menu, e);
},
getConnStatusAtom,
getWaveObjectAtom: WOS.getWaveObjectAtom,
getBlockMetaKeyAtom,
};
}