JadeView Introduction
Project Overview
JadeView is built for Web interfaces: lightweight, secure, and simple to use. It makes applications smooth and beautiful, boosting development efficiency dramatically.
Key Features
- Cross-platform support: Supports both Windows and Linux platforms
- WebView integration: Provides a modern Web browsing experience
- Flexible window management: Supports creating, closing, maximizing, minimizing, and other window operations
- Event handling mechanism: Provides a rich set of event types and callback mechanisms
- Theme management: Supports switching between Light, Dark, and System themes
- Local server: Built-in local server functionality with support for custom protocols
- Safe memory management: Strict memory management mechanism that prevents memory leaks
Memory Management Mechanism
The JadeView DLL adopts a strict memory management mechanism to ensure that repeated calls from callers such as E language (易语言) do not cause memory overflow:
- Safe string conversion: Uses Rust's
CStr::from_ptrandCString::newmethods for string conversion, ensuring memory safety - Automatic memory release: All memory allocated via
CString::newis automatically released after the callback function executes, preventing memory leaks - No direct malloc/free calls: The API does not directly use
mallocandfreeto allocate memory internally, reducing the risk of memory leaks - Strict lifecycle control: When a callback function executes, the lifecycle of the
CStringis strictly controlled to ensure memory is released after the callback completes - Thread safety: All global state access is protected by mutexes, ensuring thread safety
Quick Start
- Register the app-ready event: Register the application-ready event via
jade_on("app-ready", callback)(must be done before initializing the DLL) - Initialize the DLL: Call the
JadeView_initfunction to initialize the DLL - Run the message loop: Call
run_message_loopto run the message loop - Create a WebView window: Call the
create_webview_windowfunction inside theapp-readyevent callback to create a window - Register other event callbacks: Register other event callbacks via
jade_on - Clean up resources: Listen for the
window-all-closedevent and calljadeview_exitto clean up resources
Notes
- Multithread safety: All API functions are thread-safe and can be called from multiple threads
- Asynchronous window creation: The
create_webview_windowfunction returns the requested window ID immediately, but the actual window creation is completed asynchronously in the event loop thread - Event handling order: Event handling may execute on different threads, so thread safety must be taken into account
- Callback return values: Window event callbacks return
const char*: NULL = allow/default, a non-empty string = block/custom response - Resource management: Call
jadeview_exitpromptly to clean up resources after use
Supported Platforms
- Windows 10/11
Copyright
© 2025 JadeView. All rights reserved.