Home / File/ hydratable.js — svelte Source File

hydratable.js — svelte Source File

Architecture documentation for hydratable.js, a javascript file in the svelte codebase. 5 imports, 0 dependents.

File javascript ClientRuntime Hydration 5 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  fd0db0bf_b4fa_ebb0_bf50_f72fe589aea4["hydratable.js"]
  3c211218_0172_f6af_dd4f_da8028a531fc["index.js"]
  fd0db0bf_b4fa_ebb0_bf50_f72fe589aea4 --> 3c211218_0172_f6af_dd4f_da8028a531fc
  f3948b0d_b92a_0767_ba6c_832767f4e2bb["hydration.js"]
  fd0db0bf_b4fa_ebb0_bf50_f72fe589aea4 --> f3948b0d_b92a_0767_ba6c_832767f4e2bb
  df278ca2_0a6c_fefe_09f2_b397500fe3c2["warnings.js"]
  fd0db0bf_b4fa_ebb0_bf50_f72fe589aea4 --> df278ca2_0a6c_fefe_09f2_b397500fe3c2
  ff387d97_d6d2_81e0_e731_656552709d27["errors.js"]
  fd0db0bf_b4fa_ebb0_bf50_f72fe589aea4 --> ff387d97_d6d2_81e0_e731_656552709d27
  c9866d91_a204_fa55_a9e3_6bcc6aaaec1e["esm-env"]
  fd0db0bf_b4fa_ebb0_bf50_f72fe589aea4 --> c9866d91_a204_fa55_a9e3_6bcc6aaaec1e
  style fd0db0bf_b4fa_ebb0_bf50_f72fe589aea4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { async_mode_flag } from '../flags/index.js';
import { hydrating } from './dom/hydration.js';
import * as w from './warnings.js';
import * as e from './errors.js';
import { DEV } from 'esm-env';

/**
 * @template T
 * @param {string} key
 * @param {() => T} fn
 * @returns {T}
 */
export function hydratable(key, fn) {
	if (!async_mode_flag) {
		e.experimental_async_required('hydratable');
	}

	if (hydrating) {
		const store = window.__svelte?.h;

		if (store?.has(key)) {
			return /** @type {T} */ (store.get(key));
		}

		if (DEV) {
			e.hydratable_missing_but_required(key);
		} else {
			w.hydratable_missing_but_expected(key);
		}
	}

	return fn();
}

Domain

Subdomains

Functions

Frequently Asked Questions

What does hydratable.js do?
hydratable.js is a source file in the svelte codebase, written in javascript. It belongs to the ClientRuntime domain, Hydration subdomain.
What functions are defined in hydratable.js?
hydratable.js defines 1 function(s): hydratable.
What does hydratable.js depend on?
hydratable.js imports 5 module(s): errors.js, esm-env, hydration.js, index.js, warnings.js.
Where is hydratable.js in the architecture?
hydratable.js is located at packages/svelte/src/internal/client/hydratable.js (domain: ClientRuntime, subdomain: Hydration, directory: packages/svelte/src/internal/client).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free