preload on focusin as well

pull/17004/head
Rich Harris 4 weeks ago
parent 1b5ff6b60a
commit f811633ef4

@ -148,18 +148,24 @@ The [`fork(...)`](svelte#fork) API, added in 5.42, makes it possible to run `awa
/** @type {import('svelte').Fork | null} */
let pending = null;
</script>
<button
onpointerenter={() => {
function preload() {
pending ??= fork(() => {
open = true;
});
}}
onpointerleave={() => {
}
function discard() {
pending?.discard();
pending = null;
}}
}
</script>
<button
onfocusin={preload}
onfocusout={discard}
onpointerenter={preload}
onpointerleave={discard}
onclick={() => {
pending?.commit();
pending = null;

Loading…
Cancel
Save