UNPKG

tiny-electron-essentials

Version:

A lightweight and modular utility library for Electron apps, offering simplified window management, tray support, IPC channels, and custom frameless window styling.

117 lines (98 loc) • 5.44 kB
# šŸŽÆ Events Reference This document contains a centralized list of all internal event constants used across the application for **IPC communication**, **window management**, **notifications**, and **app lifecycle events**. These events are grouped into three main categories: - šŸš€ **AppEvents** — IPC events between Main ā†”ļø Renderer processes. - šŸ”„ **RootEvents** — Internal app-level event emitter events. - šŸ”” **NotificationEvents** — Events related to desktop notifications. --- ## šŸš€ AppEvents (IPC Channels) These events are used to communicate between the **Main Process** and the **Renderer Process** via IPC. They represent window actions, system commands, and status checks. | Event | Description | | ----- | ----------- | | `open-devtools` | šŸ› ļø Open the developer tools. | | `set-title` | šŸ·ļø Set the window title. | | `tiny-focus-window` | šŸ” Focus the window. | | `tiny-blur-window` | šŸŒ«ļø Blur (unfocus) the window. | | `tiny-show-window` | šŸ‘ļø Show the window. | | `tiny-force-focus-window` | šŸ’Ŗ Force window to focus. | | `system-idle-time` | ā±ļø Get system idle time in milliseconds. | | `system-idle-state` | šŸ’¤ Get system idle state (`active`, `idle`, `locked`, etc.). | | `toggle-visible` | šŸ”€ Toggle window visibility. | | `app-quit` | āŒ Quit the app gracefully. | | `set-proxy` | 🌐 Set a network proxy. | | `set-proxy-error` | āŒ Proxy setting failed. | | `window-is-maximized` | ā“ Is window maximized? | | `window-maximize` | šŸ—– Maximize window. | | `window-unmaximize` | šŸ—— Unmaximize window. | | `window-minimize` | šŸ—• Minimize window. | | `window-is-focused` | ā“ Is window focused? | | `window-is-visible` | ā“ Is window visible? | | `window-is-fullscreen` | ā“ Is window fullscreen? | | `window-ready-to-show` | āœ… Window is ready to show. | | `window-hide` | šŸ™ˆ Hide window. | | `window-show` | šŸ‘ļø Show window. | | `window-close` | āŒ Close window. | | `window-destroy` | šŸ’£ Destroy window instance. | | `change-app-icon` | šŸ–¼ļø Change window icon. | | `change-tray-icon` | šŸ–¼ļø Change tray icon. | | `console-message` | šŸ–Øļø Send console message to renderer. | | `electron-cache-values` | šŸ“¦ Get Electron cache (versions, user agent, etc.). | | `ping` | šŸ“¶ Ping check (heartbeat). | | `DOMContentLoaded` | 🌐 DOM loaded in renderer. | | `resize` | šŸ“ Resize window. | | `window-move` | 🧭 Move window to position. | | `tiny-app-is-show` | šŸš€ App is shown from tray/background. | | `window-is-maximizable` | ā“ Is window maximizable? | | `window-is-closable` | ā“ Is window closable? | | `window-is-focusable` | ā“ Is window focusable? | | `window-is-fullScreenable` | ā“ Is window fullscreenable? | | `set-window-is-maximizable` | āš™ļø Set window maximizable state. | | `set-window-is-closable` | āš™ļø Set window closable state. | | `set-window-is-focusable` | āš™ļø Set window focusable state. | | `set-window-is-fullscreenable` | āš™ļø Set window fullscreenable state. | | `resized` | āœ… Window has been resized. | | `will-resize` | ā³ Window is about to resize. | --- ## šŸ”„ RootEvents (Internal Events) These events are emitted internally using Node.js EventEmitters, mainly for handling **app state changes**, **window status**, and **proxy management**. | Event | Description | | ----- | ----------- | | `IsMaximized` | šŸ—– Window maximized or restored. | | `IsFocused` | šŸ” Window focused or blurred. | | `IsVisible` | šŸ‘ļø Window visibility changed. | | `IsFullScreen` | šŸ–„ļø Window entered/exited fullscreen. | | `IsFullScreenable` | āœ… Window fullscreenable state changed. | | `IsMaximizable` | āœ… Window maximizable state changed. | | `IsClosable` | āœ… Window closable state changed. | | `IsFocusable` | āœ… Window focusable state changed. | | `SetProxyError` | āŒ Proxy setup failed. | | `SetProxy` | 🌐 Proxy set successfully. | | `Resize` | šŸ“ Window is resizing. | | `Resized` | āœ… Window resize completed. | | `WillResize` | ā³ Window about to resize. | | `Ping` | šŸ“¶ Internal heartbeat ping. | | `Ready` | šŸš€ App is fully initialized. | | `CreateFirstWindow` | šŸ—ļø First window is being created. | | `ReadyToShow` | āœ… Window is ready to show. | | `DOMContentLoaded` | 🌐 Renderer DOM fully loaded. | | `ShowApp` | šŸš€ App is shown from background/tray. | | `WindowMove` | 🧭 Window moved to new position. | --- ## šŸ”” NotificationEvents (Notification Lifecycle) These events track the lifecycle of **desktop notifications**, allowing hooks for when they are created, shown, clicked, or closed. | Event | Description | | ----- | ----------- | | `tiny-notification-create` | šŸ†• Notification created. | | `tiny-notification-show` | šŸ‘€ Notification shown. | | `tiny-notification-all` | šŸ”” Catch-all for notification events. | | `tiny-notification-click` | šŸ‘† Notification clicked. | | `tiny-notification-reply` | šŸ’¬ Notification replied (if supported). | | `tiny-notification-action` | šŸŽÆ Action button clicked. | | `tiny-notification-failed` | āŒ Notification failed. | | `tiny-notification-close` | šŸ›‘ Notification closed. | --- ## 🧠 Why Use Centralized Events? āœ… Avoid magic strings everywhere in the code. āœ… Prevent typos and mismatches between main ā†”ļø renderer IPC communication. āœ… Clean, readable, and easy to maintain. āœ… Auto-completion and type safety when using with TypeScript or JSDoc.