MCPcopy
hub / github.com/Effect-TS/effect / close

Method close

packages/effect/src/Micro.ts:3350–3362  ·  view source on GitHub ↗
(microExit: MicroExit<any, any>)

Source from the content-addressed store, hash-verified

3348 }
3349 }
3350 close(microExit: MicroExit<any, any>): Micro<void> {
3351 return suspend(() => {
3352 if (this.state._tag === "Open") {
3353 const finalizers = Array.from(this.state.finalizers).reverse()
3354 this.state = { _tag: "Closed", exit: microExit }
3355 return flatMap(
3356 forEach(finalizers, (finalizer) => exit(finalizer(microExit))),
3357 exitVoidAll
3358 )
3359 }
3360 return void_
3361 })
3362 }
3363 get fork() {
3364 return sync(() => {
3365 const newScope = new MicroScopeImpl()

Callers 1

scopedFunction · 0.95

Calls 4

suspendFunction · 0.70
forEachFunction · 0.70
exitFunction · 0.70
finalizerFunction · 0.50

Tested by

no test coverage detected