docs: Correcting Incorrect Variable Names

pull/11582/head
XIYO 2 years ago
parent 61bf97210b
commit 5d981d6b41

@ -148,17 +148,17 @@ With runes, we can use `$effect.pre`, which behaves the same as `$effect` but ru
+ let theme = $state('dark');
+ let messages = $state([]);
let div;
let viewport;
- beforeUpdate(() => {
+ $effect.pre(() => {
- if (!updatingMessages) return;
+ messages;
const autoscroll = div && div.offsetHeight + div.scrollTop > div.scrollHeight - 50;
const autoscroll = viewport && viewport.offsetHeight + viewport.scrollTop > viewport.scrollHeight - 50;
if (autoscroll) {
tick().then(() => {
div.scrollTo(0, div.scrollHeight);
viewport.scrollTo(0, viewport.scrollHeight);
});
}

Loading…
Cancel
Save