Skip to main content

Environment module

📖 Description

The Environment module contains properties to identify the runtime environment.

🗃️ Properties


🏷️ isBrowser

Contains if the environment is a browser.

Type

boolean

Example

import { Environment } from "@tripetto/builder";

if (Environment.isBrowser) {
console.log("Hello from a browser!");
}

🏷️ isNode

Contains if the environment is Node.js.

Type

boolean

Example

import { Environment } from "@tripetto/builder";

if (Environment.isNode) {
console.log("Hello from Node.js!");
}

🏷️ isWebWorker

Contains if the environment is a web worker.

Type

boolean

Example

import { Environment } from "@tripetto/builder";

if (Environment.isWebWorker) {
console.log("Hello from a web worker!");
}
``