@deskforge/runtime
v0.1.0
Published
DeskForge runtime utilities for Tauri applications
Downloads
3
Maintainers
Readme
@deskforge/runtime
Runtime utilities and helpers for DeskForge Tauri applications.
Installation
npm install @deskforge/runtimeFeatures
- Window Management - Control window size, fullscreen, minimize, maximize
- App Utilities - Get app version, name, exit, and relaunch
- IPC Communication - Type-safe communication with Tauri backend
- Event System - Listen and emit events between frontend and backend
Quick Start
import {
initWindow,
minimizeWindow,
closeWindow,
sendCommand,
onEvent
} from '@deskforge/runtime';
// Initialize window
await initWindow({
title: 'My App',
width: 1200,
height: 800,
resizable: true,
});
// Control window
await minimizeWindow();
await closeWindow();
// Send commands to backend
const result = await sendCommand('my_command', { data: 'value' });
// Listen for events
const unlisten = await onEvent('my_event', (payload) => {
console.log('Event received:', payload);
});API Reference
Window Management
initWindow(config)- Initialize window with configurationminimizeWindow()- Minimize the windowmaximizeWindow()- Maximize the windowcloseWindow()- Close the windowtoggleFullscreen()- Toggle fullscreen modeshowWindow()- Show the windowhideWindow()- Hide the window
App Utilities
initApp(config)- Initialize app with configurationgetAppVersion()- Get app versiongetAppName()- Get app nameexitApp(code)- Exit the applicationrelaunchApp()- Relaunch the application
IPC Communication
sendCommand<T>(command, payload)- Send command to backendonEvent(event, callback)- Listen for eventsemitEvent(event, payload)- Emit event to backendcreateIPCHandler<T>(command)- Create typed IPC handler
Types
interface WindowConfig {
title?: string;
width?: number;
height?: number;
minWidth?: number;
minHeight?: number;
resizable?: boolean;
fullscreen?: boolean;
}
interface AppConfig {
name: string;
version: string;
author?: string;
}
interface IPCMessage {
command: string;
payload?: any;
}
interface IPCResponse {
success: boolean;
data?: any;
error?: string;
}License
MIT
