mirror of https://github.com/sveltejs/svelte
feat: add $effect.active rune (#9591)
* chore: add $effect.active rune * chore: add $effect.active runepull/9598/head
parent
13aef5245b
commit
cf9130613d
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
feat: add $effect.active rune
|
@ -0,0 +1,15 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
ssrHtml: `
|
||||
<p>false</p>
|
||||
<p>false</p>
|
||||
<p>false</p>
|
||||
`,
|
||||
|
||||
html: `
|
||||
<p>false</p>
|
||||
<p>true</p>
|
||||
<p>true</p>
|
||||
`
|
||||
});
|
@ -0,0 +1,11 @@
|
||||
<script>
|
||||
const foo = $effect.active();
|
||||
let bar = $state(false);
|
||||
$effect.pre(() => {
|
||||
bar = $effect.active();
|
||||
});
|
||||
</script>
|
||||
|
||||
<p>{foo}</p>
|
||||
<p>{bar}</p>
|
||||
<p>{$effect.active()}</p>
|
Loading…
Reference in new issue