index.js — svelte Source File
Architecture documentation for index.js, a javascript file in the svelte codebase. 7 imports, 5 dependents.
Entity Profile
Dependency Diagram
graph LR b874f390_a6ee_7d84_7151_b2b77f0388d5["index.js"] cb946435_ce66_d1e8_6bee_287bdb07e7c5["utils.js"] b874f390_a6ee_7d84_7151_b2b77f0388d5 --> cb946435_ce66_d1e8_6bee_287bdb07e7c5 fa007f2b_f437_c5ef_5c2d_ea8b5902500f["noop"] b874f390_a6ee_7d84_7151_b2b77f0388d5 --> fa007f2b_f437_c5ef_5c2d_ea8b5902500f ff67bcc0_629f_eab4_221d_71e6bc15e31e["run_all"] b874f390_a6ee_7d84_7151_b2b77f0388d5 --> ff67bcc0_629f_eab4_221d_71e6bc15e31e 9068d26c_037d_ff15_43b8_824380424345["equality.js"] b874f390_a6ee_7d84_7151_b2b77f0388d5 --> 9068d26c_037d_ff15_43b8_824380424345 b3727276_e6f9_12a7_bfa7_3faf14f08373["safe_not_equal"] b874f390_a6ee_7d84_7151_b2b77f0388d5 --> b3727276_e6f9_12a7_bfa7_3faf14f08373 dacfcaf1_66cb_9fe3_083b_4fee2b4eb64f["utils.js"] b874f390_a6ee_7d84_7151_b2b77f0388d5 --> dacfcaf1_66cb_9fe3_083b_4fee2b4eb64f 257e3ffe_958d_4447_c42b_d1cd05172fdb["subscribe_to_store"] b874f390_a6ee_7d84_7151_b2b77f0388d5 --> 257e3ffe_958d_4447_c42b_d1cd05172fdb 49e6453b_f889_68d3_168f_19a644745ce8["store.js"] 49e6453b_f889_68d3_168f_19a644745ce8 --> b874f390_a6ee_7d84_7151_b2b77f0388d5 5230511f_b608_2c86_cb6b_11014fdf94b5["spring.js"] 5230511f_b608_2c86_cb6b_11014fdf94b5 --> b874f390_a6ee_7d84_7151_b2b77f0388d5 99a316ef_52a9_1ecb_3a20_489761af28ad["tweened.js"] 99a316ef_52a9_1ecb_3a20_489761af28ad --> b874f390_a6ee_7d84_7151_b2b77f0388d5 063b7444_1ece_6350_07c7_3c77919f3844["index-client.js"] 063b7444_1ece_6350_07c7_3c77919f3844 --> b874f390_a6ee_7d84_7151_b2b77f0388d5 2bdbc2e5_a0d9_6f47_66f9_fca27e2bedfd["index-server.js"] 2bdbc2e5_a0d9_6f47_66f9_fca27e2bedfd --> b874f390_a6ee_7d84_7151_b2b77f0388d5 style b874f390_a6ee_7d84_7151_b2b77f0388d5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/** @import { Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable } from '../public.js' */
/** @import { Stores, StoresValues, SubscribeInvalidateTuple } from '../private.js' */
import { noop, run_all } from '../../internal/shared/utils.js';
import { safe_not_equal } from '../../internal/client/reactivity/equality.js';
import { subscribe_to_store } from '../utils.js';
/**
* @type {Array<SubscribeInvalidateTuple<any> | any>}
*/
const subscriber_queue = [];
/**
* Creates a `Readable` store that allows reading by subscription.
*
* @template T
* @param {T} [value] initial value
* @param {StartStopNotifier<T>} [start]
* @returns {Readable<T>}
*/
export function readable(value, start) {
return {
subscribe: writable(value, start).subscribe
};
}
/**
* Create a `Writable` store that allows both updating and reading by subscription.
*
* @template T
* @param {T} [value] initial value
* @param {StartStopNotifier<T>} [start]
* @returns {Writable<T>}
*/
export function writable(value, start = noop) {
/** @type {Unsubscriber | null} */
let stop = null;
/** @type {Set<SubscribeInvalidateTuple<T>>} */
const subscribers = new Set();
/**
* @param {T} new_value
* @returns {void}
*/
function set(new_value) {
if (safe_not_equal(value, new_value)) {
value = new_value;
if (stop) {
// store is ready
const run_queue = !subscriber_queue.length;
for (const subscriber of subscribers) {
subscriber[1]();
subscriber_queue.push(subscriber, value);
}
if (run_queue) {
for (let i = 0; i < subscriber_queue.length; i += 2) {
subscriber_queue[i][0](subscriber_queue[i + 1]);
}
subscriber_queue.length = 0;
}
// ... (150 more lines)
Domain
Subdomains
Imported By
Source
Frequently Asked Questions
What does index.js do?
index.js is a source file in the svelte codebase, written in javascript. It belongs to the SharedInternal domain, BitFlags subdomain.
What functions are defined in index.js?
index.js defines 5 function(s): derived, get, readable, readonly, writable.
What does index.js depend on?
index.js imports 7 module(s): equality.js, noop, run_all, safe_not_equal, subscribe_to_store, utils.js, utils.js.
What files import index.js?
index.js is imported by 5 file(s): index-client.js, index-server.js, spring.js, store.js, tweened.js.
Where is index.js in the architecture?
index.js is located at packages/svelte/src/store/shared/index.js (domain: SharedInternal, subdomain: BitFlags, directory: packages/svelte/src/store/shared).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free