Use Closure::once instead of Closure::wrap
This commit is contained in:
parent
1d4d37b6ea
commit
f748fbf265
1 changed files with 5 additions and 7 deletions
|
@ -257,18 +257,16 @@ fn on_success(event: &Event, decrypted: &DecryptedData, expires: &str) {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
put_action.set_onsuccess(Some(
|
put_action.set_onsuccess(Some(
|
||||||
Closure::wrap(Box::new(|| {
|
Closure::once(Box::new(|| {
|
||||||
log!("success");
|
log!("success");
|
||||||
load_from_db();
|
load_from_db();
|
||||||
}) as Box<dyn Fn()>)
|
}))
|
||||||
.into_js_value()
|
.into_js_value()
|
||||||
.unchecked_ref(),
|
.unchecked_ref(),
|
||||||
));
|
));
|
||||||
put_action.set_onerror(Some(
|
put_action.set_onerror(Some(
|
||||||
Closure::wrap(Box::new(|e| {
|
Closure::once(Box::new(|e: Event| log!(e)))
|
||||||
log!(e);
|
.into_js_value()
|
||||||
}) as Box<dyn Fn(Event)>)
|
.unchecked_ref(),
|
||||||
.into_js_value()
|
|
||||||
.unchecked_ref(),
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue