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

Function write

packages/effect/src/unstable/reactivity/Atom.ts:983–990  ·  view source on GitHub ↗
(ctx: WriteContext<SubscriptionRef.SubscriptionRef<any>>, value: any)

Source from the content-addressed store, hash-verified

981 ) => any
982) => {
983 function write(ctx: WriteContext<SubscriptionRef.SubscriptionRef<any>>, value: any) {
984 const ref = ctx.get(refAtom)
985 if (SubscriptionRef.isSubscriptionRef(ref)) {
986 Effect.runSync(SubscriptionRef.set(ref, value))
987 } else if (AsyncResult.isSuccess(ref)) {
988 Effect.runSync(SubscriptionRef.set(ref.value, value))
989 }
990 }
991 return writable((get) => {
992 const ref = get(refAtom)
993 if (SubscriptionRef.isSubscriptionRef(ref)) {

Callers 1

Atom.tsFile · 0.70

Calls 4

batchFunction · 0.70
getMethod · 0.65
setMethod · 0.65
refreshSelfMethod · 0.65

Tested by

no test coverage detected