loop.js — svelte Source File
Architecture documentation for loop.js, a javascript file in the svelte codebase. 1 imports, 3 dependents.
Entity Profile
Dependency Diagram
graph LR 385470d9_b5f1_1cd1_d8da_e61454f3e60a["loop.js"] fa5af256_aedf_fd58_ea3f_a0325a1204b6["timing.js"] 385470d9_b5f1_1cd1_d8da_e61454f3e60a --> fa5af256_aedf_fd58_ea3f_a0325a1204b6 e29c417d_6c26_6125_97f5_600e95e02dac["transitions.js"] e29c417d_6c26_6125_97f5_600e95e02dac --> 385470d9_b5f1_1cd1_d8da_e61454f3e60a 5230511f_b608_2c86_cb6b_11014fdf94b5["spring.js"] 5230511f_b608_2c86_cb6b_11014fdf94b5 --> 385470d9_b5f1_1cd1_d8da_e61454f3e60a 99a316ef_52a9_1ecb_3a20_489761af28ad["tweened.js"] 99a316ef_52a9_1ecb_3a20_489761af28ad --> 385470d9_b5f1_1cd1_d8da_e61454f3e60a style 385470d9_b5f1_1cd1_d8da_e61454f3e60a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/** @import { TaskCallback, Task, TaskEntry } from '#client' */
import { raf } from './timing.js';
// TODO move this into timing.js where it probably belongs
/**
* @returns {void}
*/
function run_tasks() {
// use `raf.now()` instead of the `requestAnimationFrame` callback argument, because
// otherwise things can get wonky https://github.com/sveltejs/svelte/pull/14541
const now = raf.now();
raf.tasks.forEach((task) => {
if (!task.c(now)) {
raf.tasks.delete(task);
task.f();
}
});
if (raf.tasks.size !== 0) {
raf.tick(run_tasks);
}
}
/**
* Creates a new task that runs on each raf frame
* until it returns a falsy value or is aborted
* @param {TaskCallback} callback
* @returns {Task}
*/
export function loop(callback) {
/** @type {TaskEntry} */
let task;
if (raf.tasks.size === 0) {
raf.tick(run_tasks);
}
return {
promise: new Promise((fulfill) => {
raf.tasks.add((task = { c: callback, f: fulfill }));
}),
abort() {
raf.tasks.delete(task);
}
};
}
Domain
Subdomains
Functions
Dependencies
Imported By
Source
Frequently Asked Questions
What does loop.js do?
loop.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 loop.js?
loop.js defines 2 function(s): loop, run_tasks.
What does loop.js depend on?
loop.js imports 1 module(s): timing.js.
What files import loop.js?
loop.js is imported by 3 file(s): spring.js, transitions.js, tweened.js.
Where is loop.js in the architecture?
loop.js is located at packages/svelte/src/internal/client/loop.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