MCPcopy Create free account
hub / github.com/Effect-TS/effect / subscribe

Method subscribe

packages/effect/src/unstable/reactivity/AtomRef.ts:213–223  ·  view source on GitHub ↗
(f: (a: B) => void)

Source from the content-addressed store, hash-verified

211 return this.transform(this.parent.value)
212 }
213 subscribe(f: (a: B) => void): () => void {
214 let previous = this.transform(this.parent.value)
215 return this.parent.subscribe((a) => {
216 const next = this.transform(a)
217 if (Equal.equals(next, previous)) {
218 return
219 }
220 previous = next
221 f(next)
222 })
223 }
224 map<C>(f: (a: B) => C): ReadonlyRef<C> {
225 return new MapRefImpl(this, f)
226 }

Callers

nothing calls this directly

Calls 4

equalsMethod · 0.80
transformMethod · 0.65
subscribeMethod · 0.65
fFunction · 0.50

Tested by

no test coverage detected