Home / Class/ ReactiveValue Class — svelte Architecture

ReactiveValue Class — svelte Architecture

Architecture documentation for the ReactiveValue class in reactive-value.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  b486621e_e5a2_e818_93d0_84358fa8b8a7["ReactiveValue"]
  01ad7075_03ac_8603_15c0_1261b1448369["reactive-value.js"]
  b486621e_e5a2_e818_93d0_84358fa8b8a7 -->|defined in| 01ad7075_03ac_8603_15c0_1261b1448369
  142e2be6_1ec4_1b85_9b82_cefdeae4a983["constructor()"]
  b486621e_e5a2_e818_93d0_84358fa8b8a7 -->|method| 142e2be6_1ec4_1b85_9b82_cefdeae4a983
  865b9a5e_84ff_b46d_286f_fa6d0056e694["current()"]
  b486621e_e5a2_e818_93d0_84358fa8b8a7 -->|method| 865b9a5e_84ff_b46d_286f_fa6d0056e694

Relationship Graph

Source Code

packages/svelte/src/reactivity/reactive-value.js lines 6–24

export class ReactiveValue {
	#fn;
	#subscribe;

	/**
	 *
	 * @param {() => T} fn
	 * @param {(update: () => void) => void} onsubscribe
	 */
	constructor(fn, onsubscribe) {
		this.#fn = fn;
		this.#subscribe = createSubscriber(onsubscribe);
	}

	get current() {
		this.#subscribe();
		return this.#fn();
	}
}

Frequently Asked Questions

What is the ReactiveValue class?
ReactiveValue is a class in the svelte codebase, defined in packages/svelte/src/reactivity/reactive-value.js.
Where is ReactiveValue defined?
ReactiveValue is defined in packages/svelte/src/reactivity/reactive-value.js at line 6.

Analyze Your Own Codebase

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

Try Supermodel Free