effect-active
ComputerGuy 2 months ago
parent 7b33b2ab54
commit ab91795ac8

@ -240,12 +240,12 @@ declare namespace $effect {
/**
* The `$effect.active` rune is an advanced feature that indicates whether an effect or async `$derived` can be created in the current context.
* Effects and async deriveds can only be created in root effects, which are created during component setup, or can be programmatically created via `$effect.root`.
*
*
* Example:
* ```svelte
* <script>
* console.log('in component setup', $effect.active()); // true
*
*
* function onclick() {
* console.log('after component setup', $effect.active()); // false
* }
@ -261,7 +261,7 @@ declare namespace $effect {
* <button {onclick}>Click me!</button>
* <button {ondblclick}>Click me twice!</button>
* ```
*
*
* https://svelte.dev/docs/svelte/$effect#$effect.active
*/
export function active(): boolean;

@ -45,4 +45,4 @@ export const DOCUMENT_FRAGMENT_NODE = 11;
export const VALID_EFFECT_PARENT = 0;
export const EFFECT_ORPHAN = 1;
export const UNOWNED_DERIVED_PARENT = 2;
export const EFFECT_TEARDOWN = 3;
export const EFFECT_TEARDOWN = 3;

@ -3314,12 +3314,12 @@ declare namespace $effect {
/**
* The `$effect.active` rune is an advanced feature that indicates whether an effect or async `$derived` can be created in the current context.
* Effects and async deriveds can only be created in root effects, which are created during component setup, or can be programmatically created via `$effect.root`.
*
*
* Example:
* ```svelte
* <script>
* console.log('in component setup', $effect.active()); // true
*
*
* function onclick() {
* console.log('after component setup', $effect.active()); // false
* }
@ -3335,7 +3335,7 @@ declare namespace $effect {
* <button {onclick}>Click me!</button>
* <button {ondblclick}>Click me twice!</button>
* ```
*
*
* https://svelte.dev/docs/svelte/$effect#$effect.active
*/
export function active(): boolean;

Loading…
Cancel
Save