From f748fbf26589447bdf1b22a447983ddc203c63ed Mon Sep 17 00:00:00 2001 From: Edward Shen Date: Sun, 31 Oct 2021 12:43:44 -0700 Subject: [PATCH] Use Closure::once instead of Closure::wrap --- web/src/main.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/web/src/main.rs b/web/src/main.rs index 9842622..eb67174 100644 --- a/web/src/main.rs +++ b/web/src/main.rs @@ -257,18 +257,16 @@ fn on_success(event: &Event, decrypted: &DecryptedData, expires: &str) { ) .unwrap(); put_action.set_onsuccess(Some( - Closure::wrap(Box::new(|| { + Closure::once(Box::new(|| { log!("success"); load_from_db(); - }) as Box) + })) .into_js_value() .unchecked_ref(), )); put_action.set_onerror(Some( - Closure::wrap(Box::new(|e| { - log!(e); - }) as Box) - .into_js_value() - .unchecked_ref(), + Closure::once(Box::new(|e: Event| log!(e))) + .into_js_value() + .unchecked_ref(), )); }