62 lines
1.7 KiB
TypeScript
62 lines
1.7 KiB
TypeScript
export function useCore() {
|
|
const openExternal = (url: string) => {
|
|
window.shell.openExternal(url);
|
|
};
|
|
|
|
const showItemInFolder = (fullPath: string) => {
|
|
window.shell.showItemInFolder(fullPath);
|
|
};
|
|
|
|
const getCoreVersion = async () => {
|
|
const version = await window.electron.ipcRenderer.invoke('ipcCore:getCoreVersion');
|
|
return version;
|
|
}
|
|
|
|
const getArch = async () => {
|
|
const arch = await window.electron.ipcRenderer.invoke('ipcCore:getArch');
|
|
return arch;
|
|
}
|
|
|
|
const getUserDir = async () => {
|
|
const userDir = await window.electron.ipcRenderer.invoke('ipcCore:getUserDir');
|
|
return userDir;
|
|
}
|
|
|
|
const getAppPath = async () => {
|
|
const appPath = await window.electron.ipcRenderer.invoke('ipcCore:getAppPath');
|
|
return appPath;
|
|
}
|
|
|
|
const getDownloadsPath = async () => {
|
|
const downloadsPath = await window.electron.ipcRenderer.invoke('ipcCore:getDownloadsPath');
|
|
return downloadsPath;
|
|
}
|
|
|
|
const getPlatform = async () => {
|
|
const platform = await window.electron.ipcRenderer.invoke('ipcCore:getPlatform');
|
|
return platform;
|
|
}
|
|
|
|
const getDeviceName = async () => {
|
|
const deviceName = await window.electron.ipcRenderer.invoke('device:name');
|
|
return deviceName;
|
|
}
|
|
|
|
const getDeviceId = async () => {
|
|
const deviceId = await window.electron.ipcRenderer.invoke('device:id');
|
|
return deviceId;
|
|
}
|
|
|
|
return {
|
|
openExternal,
|
|
showItemInFolder,
|
|
getCoreVersion,
|
|
getArch,
|
|
getUserDir,
|
|
getAppPath,
|
|
getDownloadsPath,
|
|
getPlatform,
|
|
getDeviceName,
|
|
getDeviceId
|
|
}
|
|
} |