Files
esengine/packages/editor-app/src/api/tauri.ts

71 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-10-14 22:53:26 +08:00
import { invoke } from '@tauri-apps/api/core';
/**
* Tauri IPC
*/
export class TauriAPI {
/**
*
*/
static async greet(name: string): Promise<string> {
return await invoke<string>('greet', { name });
}
2025-10-15 00:23:19 +08:00
static async openProjectDialog(): Promise<string | null> {
return await invoke<string | null>('open_project_dialog');
}
2025-10-14 22:53:26 +08:00
static async openProject(path: string): Promise<string> {
return await invoke<string>('open_project', { path });
}
/**
*
*/
static async saveProject(path: string, data: string): Promise<void> {
return await invoke<void>('save_project', { path, data });
}
/**
*
*/
static async exportBinary(data: Uint8Array, outputPath: string): Promise<void> {
return await invoke<void>('export_binary', {
data: Array.from(data),
outputPath
});
}
2025-10-15 00:40:27 +08:00
/**
*
*/
static async scanDirectory(path: string, pattern: string): Promise<string[]> {
return await invoke<string[]>('scan_directory', { path, pattern });
}
/**
*
*/
static async readFileContent(path: string): Promise<string> {
return await invoke<string>('read_file_content', { path });
}
2025-10-14 22:53:26 +08:00
}
/**
*
*/
export interface ProjectInfo {
name: string;
path: string;
version: string;
}
/**
*
*/
export interface EditorConfig {
theme: string;
autoSave: boolean;
recentProjects: string[];
}