Skip to content

Commit f811633

Browse files
committed
preload on focusin as well
1 parent 1b5ff6b commit f811633

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

documentation/docs/03-template-syntax/19-await-expressions.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,24 @@ The [`fork(...)`](svelte#fork) API, added in 5.42, makes it possible to run `awa
148148
149149
/** @type {import('svelte').Fork | null} */
150150
let pending = null;
151-
</script>
152151
153-
<button
154-
onpointerenter={() => {
152+
function preload() {
155153
pending ??= fork(() => {
156154
open = true;
157155
});
158-
}}
159-
onpointerleave={() => {
156+
}
157+
158+
function discard() {
160159
pending?.discard();
161160
pending = null;
162-
}}
161+
}
162+
</script>
163+
164+
<button
165+
onfocusin={preload}
166+
onfocusout={discard}
167+
onpointerenter={preload}
168+
onpointerleave={discard}
163169
onclick={() => {
164170
pending?.commit();
165171
pending = null;

0 commit comments

Comments
 (0)