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
Markdown
# šÆ 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.