21 releases
new 0.3.13 | Dec 8, 2024 |
---|---|
0.3.10 | Nov 20, 2024 |
0.2.0 | Nov 18, 2024 |
0.1.9 | Oct 12, 2024 |
#5 in #event
1,625 downloads per month
Used in wgpu_starter
14KB
69 lines
use js_resized_event_channel::{JsResizeEventChannel, ResizeEventChannel};
use winit::{dpi::PhysicalSize, event_loop::EventLoop, window::WindowAttributes};
fn main() {
let event_loop: EventLoop<()> = EventLoop::new().unwrap();
let window = event_loop
.create_window(WindowAttributes::default())
.unwrap();
let resize_event_channel = JsResizeEventChannel::init(&window);
event_loop
.run(|event, event_loop| {
if resize_event_channel.try_recv_resized_event() {
let _ = window.request_inner_size(resize_event_channel.size());
}
})
.unwrap();
}
Dependencies
~3–17MB
~247K SLoC