Skip to main content
Glama

MCP Svelte Docs Server

# $effect.pending Definition **Definition:** Returns number of pending promises in the current boundary **Syntax:** `$effect.pending(): number` **Parameters:** None **Returns:** Number of pending promises, not including child boundaries **Variants:** - Part of `$effect` rune family ## Examples ```js // Monitor pending async operations let a = $state(1); let b = $state(2); async function add(x, y) { await new Promise(resolve => setTimeout(resolve, 1000)); return x + y; } // In template or effect $effect(() => { const pending = $effect.pending(); if (pending > 0) { console.log(`${pending} promises are pending`); } }); // Usage with await expressions {#if $effect.pending()} <p>Loading... ({$effect.pending()} operations pending)</p> {/if} <p>{a} + {b} = {await add(a, b)}</p> // Conditional rendering based on pending state {#if $effect.pending() > 0} <div class="loading-spinner"> Processing {$effect.pending()} operations... </div> {/if} ``` ## Related - `await-expressions` - Async template expressions that create pending promises - `$effect` - For effects that can monitor pending state - `$effect.tracking` - For checking if code is in tracking context

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/spences10/mcp-svelte-docs'

If you have feedback or need assistance with the MCP directory API, please join our Discord server