MCPcopy
hub / github.com/sveltejs/svelte / #init

Method #init

packages/svelte/src/reactivity/set.js:92–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90
91 // We init as part of the first instance so that we can treeshake this class
92 #init() {
93 inited = true;
94
95 var proto = SvelteSet.prototype;
96 var set_proto = Set.prototype;
97
98 for (const method of read_methods) {
99 // @ts-ignore
100 proto[method] = function (...v) {
101 get(this.#version);
102 // @ts-ignore
103 return set_proto[method].apply(this, v);
104 };
105 }
106
107 for (const method of set_like_methods) {
108 // @ts-ignore
109 proto[method] = function (...v) {
110 get(this.#version);
111 // @ts-ignore
112 var set = /** @type {Set<T>} */ (set_proto[method].apply(this, v));
113 return new SvelteSet(set);
114 };
115 }
116 }
117
118 /** @param {T} value */
119 has(value) {

Callers 1

constructorMethod · 0.95

Calls 2

getFunction · 0.90
applyMethod · 0.45

Tested by

no test coverage detected