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

Method close

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

Source from the content-addressed store, hash-verified

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