JadeView Class
Overview
JadeViewis the unique global singleton entry of the E-Language SDK. It is automatically generated after importingJadeView.ecand requires no manual definition. It encapsulates kernel initialization, window & view management, event system, two-way IPC communication, pop-up dialogs, notifications and low-level system capabilities in a unified manner. All functions are invoked viaJadeView.SubModule.Subroutine().Recommended Standard Execution Order
Register the app ready event:
JadeView.App.RegisterEvent(#Event_AppReady, &CallbackSubroutine). This step must be executed before initialization.Initialize the kernel: Call
JadeView.App.Initto loadjadeview_x86.dll.Run the message loop: Call
JadeView.App.MessageLoop.Create WebView window: Invoke
MarkdownJadeView.Window.Createinside the
Markdown#Event_AppReadycallback subroutine.
Important: Windows can only be created after the
#Event_AppReadyevent is triggered.Register other events: Bind additional event callbacks via
JadeView.App.RegisterEvent.Clean up resources: Listen to the
#Event_AllWindowsClosedevent and callJadeView.App.Exitto release all kernel resources.
I. Kernel Initialization & Message Loop (JadeView.App)
1. Init
- Function: Load the
jadeview_x86.dllruntime and automatically subscribe to most common built-in events. - List of auto-subscribed events: App ready, second instance launch, window creation/destruction, page loading status, page title & favicon update, frontend IPC messages, global hotkeys, system notifications.
- Parameters: Log switch, log path, app ID, app name, single-instance flag. All Chinese text inputs must be converted to UTF-8.
- Return Value: Boolean.
True= Kernel loaded successfully;False= Missing DLL or incompatible version.
2. MessageLoop
- Function: Continuously listen to and dispatch all asynchronous events (windows, IPC, hotkeys, dialogs, tray notifications).
- Execution Position: Execute after successful kernel initialization at the end of the main thread. The loop exits when the program is ready to terminate.
II. Window & View Capabilities (JadeView.Window + JadeView.Page)
Full lifecycle control for Web windows, supporting standard, borderless and title-overlay window styles.
Window Functions
- Create Window: Use the
JadeViewWindowSettingstruct to configure size, title, Mica/Acrylic material, border style, topmost state, min/max size limits, screenshot protection and taskbar progress bar. - Runtime Control: Dynamically switch light/dark themes, adjust window layers (topmost / normal / desktop widget), show/hide, minimize/maximize, modify coordinates and dimensions.
- Material Configuration: Supports three Windows 11 transparent materials:
mica,micaAlt,acrylic.
Page View Functions
- Page navigation and forced refresh (cache skip supported).
- Execute frontend JS code and retrieve return results.
- Page zoom control, media autoplay toggle, incognito cache management.
III. Event System (JadeView.App.RegisterEvent)
1. Auto-Subscribed Events
Automatically bound during kernel initialization; only corresponding callback subroutines need to be written:
- #Event_AppReady
- #Event_SecondInstance
- #Event_WindowCreated / #Event_WindowClosed / #Event_WindowStateChanged
- #Event_WebViewStartLoad / #Event_WebViewFinishLoad
- #Event_WebViewFaviconUpdated / #Event_WebViewTitleUpdated
- #Event_PostMessageReceived (General IPC message)
- #Event_GlobalHotkeyTriggered
- #Event_NotificationShown / #Event_NotificationAction / #Event_NotificationDismissed
2. Manually Registered Events
Not subscribed automatically; explicitly call
RegisterEventwhen required:- #Event_WindowWillClose
- #Event_DragDrop (File drag into window)
- #Event_WebViewNewWindowRequest
- #Event_WebViewDownloadComplete
3. Interceptable Events
Rule: Callback returns empty string = Allow default behavior; Callback returns non-empty UTF-8 string = Block native logic.
- #Event_WindowWillClose: Block window closing operation
- #Event_DragDrop: Block file drag & drop
- #Event_WebViewNewWindowRequest: Block pop-up new tabs
- #Event_WebViewDownloadComplete: Cancel file download
IV. Two-Way IPC Communication (JadeView.IPC)
Dedicated data exchange channel between E-Language backend and webpage JS. Dedicated channel subscription is recommended over generic event handling.
- Subscribe Channel:
JadeView.IPC.Subscribe(ChannelName, &Callback). A single callback receives all messages sent from the matching frontend channel. - Broadcast Push:
JadeView.IPC.Broadcast(WindowID, ChannelName, MessageText). Backend actively sends data to the webpage. - Frontend Rules: Pages can only send data via
jade.invoke(channel, data)and receive data viajade.on(channel, callback). There is nojade.sendmethod.
V. Dialog Utilities (JadeView.Dialog)
Split into synchronous and asynchronous dialogs, with dedicated structs for parameter configuration.
Synchronous Dialogs (Block thread and wait for user input)
- Open File Dialog
- Save File Dialog
- Standard Info MessageBox
- Error Alert MessageBox
Asynchronous Dialogs (Non-blocking; receive results via event callbacks)
- Async Open File
- Async Save File
- Async Message Popup
Matching Structs
MessageBoxOption,FileDialogOption. Configurable items: title, buttons, file filters, multi-selection, hidden file display.VI. System Notifications (JadeView.Notification)
Windows desktop toast notifications, customizable title, body text, icons, dual action buttons and auto-close duration.
- Subroutine:
JadeView.Notification.Show(NotifyOptionStruct) - Related Events: Notification click, notification close, notification display failure (all support callback listening).
VII. Tray Menu (JadeView.Tray)
Background resident tray icon feature for the system taskbar corner.
- Create tray icon and set hover tooltip text.
- Add tray items: Normal command buttons, submenus, separators, logical groups.
- Clear all tray menus.
- Related Events: Tray left/right click, tray menu command trigger.
VIII. Low-Level System Utilities (JadeView.System)
1. Protocol Management
- Register / unregister custom URL protocols (launch app via
xxx://links). - Create
jade://local static resource service with hot-reload support.
2. Global Hotkeys
Register / unregister global shortcuts, supporting combined modifiers: Ctrl / Shift / Alt / Win.
3. System Path Lookup
Quickly access desktop, documents, cache, executable root and other directories via
#Path_XXXconstants.4. OS Version Detection
JadeView.System.IsWin11(): Judge whether Mica transparent materials are supported.5. YAML Read & Write
JadeView.YamlConfig: Lightweight local persistent storage for application settings.IX. Encrypted Resource Package Capabilities (JadeView.ProtocolService + JadeView.JAPK)
- Load signed JAPK encrypted resource packages; run assets in memory without writing to disk to prevent frontend source extraction.
- Convert numeric error codes to human-readable error descriptions for troubleshooting load failures.
- Unload loaded JAPK packages to free occupied memory.
X. Auxiliary Submodules
- JadeView.Text: GBK ↔ UTF-8 encoding conversion (Mandatory for all Chinese input parameters).
- JadeView.Clipboard: Read and write system clipboard text.
- JadeView.ContextMenu: Custom Web right-click menus, supporting command items, checkboxes, radio buttons and native browser menu entries.
- JadeView.Time: NTP network time synchronization & global timezone conversion.