20 releases
new 0.3.10 | Nov 20, 2024 |
---|---|
0.3.9 | Nov 20, 2024 |
0.2.0 | Nov 18, 2024 |
0.1.9 | Oct 12, 2024 |
#3 in #event
219 downloads per month
7KB
77 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–16MB
~241K SLoC