From 91a511ba8c9f19f4a262dccf14f54ce0fed27f0b Mon Sep 17 00:00:00 2001 From: Ben Merritt Date: Fri, 7 Jun 2019 22:35:40 -0700 Subject: [PATCH] Replace JS snippet with throw_str --- src/platform_impl/web_sys/event_loop.rs | 9 +-------- src/platform_impl/web_sys/util.js | 3 --- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 src/platform_impl/web_sys/util.js diff --git a/src/platform_impl/web_sys/event_loop.rs b/src/platform_impl/web_sys/event_loop.rs index 62bbd82a..d7c5779e 100644 --- a/src/platform_impl/web_sys/event_loop.rs +++ b/src/platform_impl/web_sys/event_loop.rs @@ -69,12 +69,6 @@ struct EventLoopRunner { event_handler: Box, &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 EventLoop { pub fn new() -> Self { EventLoop { @@ -161,8 +155,7 @@ impl EventLoop { // 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 '!' - throw_to_escape_event_loop(); - unreachable!(); + wasm_bindgen::throw_str("Using exceptions for control flow, don't mind me. This isn't actually an error!"); } pub fn create_proxy(&self) -> EventLoopProxy { diff --git a/src/platform_impl/web_sys/util.js b/src/platform_impl/web_sys/util.js deleted file mode 100644 index 57c40e22..00000000 --- a/src/platform_impl/web_sys/util.js +++ /dev/null @@ -1,3 +0,0 @@ -export function throwToEscapeEventLoop() { - throw "Using exceptions for control flow, don't mind me. This isn't actually an error!"; -} \ No newline at end of file