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

Method makeRef

packages/effect/src/unstable/reactivity/AtomRef.ts:310–324  ·  view source on GitHub ↗
(value: A)

Source from the content-addressed store, hash-verified

308 }
309
310 makeRef(value: A) {
311 const ref = new AtomRefImpl(value)
312 const notify = (value: A) => {
313 ref.notify(value)
314 this.notify(this.value)
315 }
316 return new Proxy(ref, {
317 get(target, p, _receiver) {
318 if (p === "notify") {
319 return notify
320 }
321 return target[p as keyof AtomRef<A>]
322 }
323 })
324 }
325
326 push(item: A) {
327 const ref = this.makeRef(item)

Callers 3

constructorMethod · 0.95
pushMethod · 0.95
insertAtMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected