Hyperlinkv0.8.0-beta.28

Fiber

Fiber.getCurrentconsteffect/Fiber.ts:605
(): Fiber<any, any> | undefined

Returns the current fiber if called from within a fiber context, otherwise returns undefined.

When to use

Use when you need low-level runtime integrations that need access to the currently executing fiber.

Gotchas

This is a synchronous accessor, not an Effect. It returns undefined outside an active fiber runtime context.

Example (Getting the current fiber)

import { Effect, Fiber } from "effect"

const program = Effect.gen(function*() {
  const current = Fiber.getCurrent()
  if (current) {
    console.log(`Current fiber ID: ${current.id}`)
  }
})
accessors
Source effect/Fiber.ts:6051 lines
export const getCurrent: () => Fiber<any, any> | undefined = effect.getCurrentFiber
Referenced by 4 symbols