mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 14:51:30 +11:00
Replace JS snippet with throw_str
This commit is contained in:
parent
94f6294c0a
commit
91a511ba8c
|
@ -69,12 +69,6 @@ struct EventLoopRunner<T> {
|
||||||
event_handler: Box<dyn FnMut(Event<T>, &mut ControlFlow)>,
|
event_handler: Box<dyn FnMut(Event<T>, &mut ControlFlow)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[wasm_bindgen(module = "/src/platform_impl/web_sys/util.js")]
|
|
||||||
extern "C" {
|
|
||||||
#[wasm_bindgen(js_name = "throwToEscapeEventLoop")]
|
|
||||||
fn throw_to_escape_event_loop();
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> EventLoop<T> {
|
impl<T> EventLoop<T> {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
EventLoop {
|
EventLoop {
|
||||||
|
@ -161,8 +155,7 @@ impl<T> EventLoop<T> {
|
||||||
|
|
||||||
// Throw an exception to break out of Rust exceution and use unreachable to tell the
|
// Throw an exception to break out of Rust exceution and use unreachable to tell the
|
||||||
// compiler this function won't return, giving it a return type of '!'
|
// compiler this function won't return, giving it a return type of '!'
|
||||||
throw_to_escape_event_loop();
|
wasm_bindgen::throw_str("Using exceptions for control flow, don't mind me. This isn't actually an error!");
|
||||||
unreachable!();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_proxy(&self) -> EventLoopProxy<T> {
|
pub fn create_proxy(&self) -> EventLoopProxy<T> {
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
export function throwToEscapeEventLoop() {
|
|
||||||
throw "Using exceptions for control flow, don't mind me. This isn't actually an error!";
|
|
||||||
}
|
|
Loading…
Reference in a new issue