Skip to main content Link Search Menu Expand Document (external link)

index overview

Environment is a small abstraction over providing runtime information about the environment we are running within.

Added in v1.0.0


Table of contents


utils

CurrentEnvironment

Signature

export declare const CurrentEnvironment: Context.Tagged<CurrentEnvironment, Environment>

Added in v1.0.0

CurrentEnvironment (interface)

Signature

export interface CurrentEnvironment extends Context.Tag.Identifier<typeof CurrentEnvironment> {}

Added in v1.0.0

Environment

Signature

export declare const Environment: {
  dom: EnvironmentValue<"dom">
  server: EnvironmentValue<"server">
  serviceWorker: EnvironmentValue<"serviceWorker">
  static: EnvironmentValue<"static">
  webWorker: EnvironmentValue<"webWorker">
}

Added in v1.0.0

Environment (type alias)

Signature

export type Environment = Environment.Value | `test:${Environment.Value}`

Added in v1.0.0

Environment (namespace)

Added in v1.0.0

Value (type alias)

Signature

export type Value = "dom" | "server" | "serviceWorker" | "static" | "webWorker"

Added in v1.0.0

EnvironmentValue (type alias)

Signature

export type EnvironmentValue<T extends Environment.Value> = T & {
  readonly test: `test:${T}`
}

Added in v1.0.0

isDom

Signature

export declare const isDom: Effect.Effect<boolean, never, CurrentEnvironment>

Added in v1.0.0

isServer

Signature

export declare const isServer: Effect.Effect<boolean, never, CurrentEnvironment>

Added in v1.0.0

isServiceWorker

Signature

export declare const isServiceWorker: Effect.Effect<boolean, never, CurrentEnvironment>

Added in v1.0.0

isStatic

Signature

export declare const isStatic: Effect.Effect<boolean, never, CurrentEnvironment>

Added in v1.0.0

isTest

Signature

export declare const isTest: Effect.Effect<boolean, never, CurrentEnvironment>

Added in v1.0.0

isWebWorker

Signature

export declare const isWebWorker: Effect.Effect<boolean, never, CurrentEnvironment>

Added in v1.0.0