Home / Function/ once() — svelte Function Reference

once() — svelte Function Reference

Architecture documentation for the once() function in event-modifiers.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  6b9cfdba_ca05_bb2e_0fdb_a6b0b9578ed8["once()"]
  10959c39_ee67_ccc9_0299_768227609d29["event-modifiers.js"]
  6b9cfdba_ca05_bb2e_0fdb_a6b0b9578ed8 -->|defined in| 10959c39_ee67_ccc9_0299_768227609d29
  7a2c4b59_fc2a_bb0e_64d7_90ce67611a9c["apply()"]
  6b9cfdba_ca05_bb2e_0fdb_a6b0b9578ed8 -->|calls| 7a2c4b59_fc2a_bb0e_64d7_90ce67611a9c
  style 6b9cfdba_ca05_bb2e_0fdb_a6b0b9578ed8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/internal/client/dom/legacy/event-modifiers.js lines 59–69

export function once(fn) {
	var ran = false;

	return function (...args) {
		if (ran) return;
		ran = true;

		// @ts-ignore
		return fn?.apply(this, args);
	};
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does once() do?
once() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dom/legacy/event-modifiers.js.
Where is once() defined?
once() is defined in packages/svelte/src/internal/client/dom/legacy/event-modifiers.js at line 59.
What does once() call?
once() calls 1 function(s): apply.

Analyze Your Own Codebase

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

Try Supermodel Free