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

Function init

packages/effect/src/Context.ts:248–265  ·  view source on GitHub ↗
(key: string, options?: {
    readonly defaultValue?: any
    readonly make?: any
    readonly fiberCached?: boolean
  })

Source from the content-addressed store, hash-verified

246 const self = KeyClass as any as Types.Mutable<Reference<any>>
247 Object.setPrototypeOf(self, ServiceProto)
248 const init = (key: string, options?: {
249 readonly defaultValue?: any
250 readonly make?: any
251 readonly fiberCached?: boolean
252 }) => {
253 self.key = key
254 if (options?.defaultValue) {
255 self[ReferenceTypeId] = ReferenceTypeId
256 self.defaultValue = options.defaultValue
257 }
258 if (options?.make) {
259 ;(self as any).make = options.make
260 }
261 if (options?.fiberCached) {
262 cacheKeys.add(key)
263 }
264 return self
265 }
266 return arguments.length > 0 ? init(arguments[0], arguments[1]) : init
267} as any
268

Callers 1

Context.tsFile · 0.70

Calls 1

addMethod · 0.65

Tested by

no test coverage detected