MCPcopy
hub / github.com/sveltejs/svelte / props_id

Function props_id

packages/svelte/src/internal/client/dom/template.js:384–401  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

382 * Create (or hydrate) an unique UID for the component instance.
383 */
384export function props_id() {
385 if (
386 hydrating &&
387 hydrate_node &&
388 hydrate_node.nodeType === COMMENT_NODE &&
389 hydrate_node.textContent?.startsWith(`$`)
390 ) {
391 const id = hydrate_node.textContent.substring(1);
392 hydrate_next();
393 return id;
394 }
395
396 // @ts-expect-error This way we ensure the id is unique even across Svelte runtimes
397 (window.__svelte ??= {}).uid ??= 1;
398
399 // @ts-expect-error
400 return `c${window.__svelte.uid++}`;
401}

Callers

nothing calls this directly

Calls 1

hydrate_nextFunction · 0.90

Tested by

no test coverage detected