-
Notifications
You must be signed in to change notification settings - Fork 27
feat(examples): add advanced window, browser profiles, error handling… #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…, and secure communication demos - introduce advanced_window example with window controls and info - add browser_profiles example for managing browser profiles and info - provide error_handling example demonstrating error reporting and recovery - add secure_communication example for encoding, binary transfer, and memory management - update win32GetHwnd for improved pointer handling on Windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces comprehensive advanced example applications demonstrating WebUI's enhanced capabilities for window management, browser profiles, error handling, and secure communication, along with an improvement to pointer handling on Windows.
- Adds four new advanced example applications showcasing different WebUI features
- Improves Windows pointer handling in the
win32GetHwnd
method - Provides comprehensive demonstrations of error handling, encoding, browser management, and window controls
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/webui.zig | Updates Windows HWND pointer handling to use optional capture syntax |
examples/secure_communication/main.zig | Implements secure communication example with encoding, binary transfer, and memory management |
examples/secure_communication/index.html | Provides UI for testing encoding/decoding and binary data transfer features |
examples/error_handling/main.zig | Demonstrates comprehensive error handling patterns throughout WebUI operations |
examples/error_handling/index.html | Interactive UI for testing various error scenarios and recovery mechanisms |
examples/browser_profiles/main.zig | Shows browser profile management and browser detection capabilities |
examples/browser_profiles/profile.html | Simple test page for demonstrating profile isolation |
examples/browser_profiles/index.html | Main UI for browser profile management and information display |
examples/advanced_window/main.zig | Comprehensive window control functionality including positioning, sizing, and system integration |
examples/advanced_window/index.html | Advanced UI with controls for all window management features |
Comments suppressed due to low confidence (1)
examples/error_handling/main.zig:18
- Function name has a typo:
isHighConstrast
should beisHighContrast
(missing 'n').
_ = try window.bind("test_encode_error", testEncodeError);
if (tmp_hwnd) |hwnd| { | ||
return @ptrCast(hwnd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The variable name hwnd
shadows the outer scope variable name tmp_hwnd
. Consider using a different name like valid_hwnd
to improve clarity.
if (tmp_hwnd) |hwnd| { | |
return @ptrCast(hwnd); | |
if (tmp_hwnd) |valid_hwnd| { | |
return @ptrCast(valid_hwnd); |
Copilot uses AI. Check for mistakes.
// Fill buffer with test data | ||
const test_data = "This is test data for memory management"; | ||
const copy_len = @min(test_data.len, buffer.len); | ||
webui.memcpy(buffer[0..copy_len], test_data[0..copy_len]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using webui.memcpy
instead of Zig's standard @memcpy
is inconsistent with the pattern used elsewhere in the file (line 44, 67). Consider using @memcpy
for consistency.
webui.memcpy(buffer[0..copy_len], test_data[0..copy_len]); | |
@memcpy(buffer[0..copy_len], test_data[0..copy_len]); |
Copilot uses AI. Check for mistakes.
}; | ||
defer webui.free(buffer2); | ||
|
||
webui.memcpy(buffer2[0..copy_len], buffer[0..copy_len]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using webui.memcpy
instead of Zig's standard @memcpy
is inconsistent with the pattern used elsewhere in the file. Consider using @memcpy
for consistency.
webui.memcpy(buffer2[0..copy_len], buffer[0..copy_len]); | |
@memcpy(buffer2[0..copy_len], buffer[0..copy_len]); |
Copilot uses AI. Check for mistakes.
Is this PR a draft? |
yes, this pr is a draft |
Many examples can only be built and passed, but the test has not been completed yet, so I need more tests |
Understood, take your time @jinzhongjia |
…, and secure communication demos