detectRuntime
Generated reference page for the detectRuntime function export.
- Import:
@kjanat/dreamcli/runtime - Export kind: function
- Declared in:
src/runtime/detect.ts - Source link:
packages/dreamcli/src/runtime/detect.ts:87
Signatures
ts
function detectRuntime(globals?: GlobalForDetect): Runtime;| Parameter | Type | Description |
|---|---|---|
globals | GlobalForDetect | undefined | Override globalThis for testing. Production callersshould omit this parameter. |
Members
Members
detectRuntime
Detect the current JavaScript runtime.
Uses globalThis feature detection to identify the host runtime. Detection order is significant: Bun is checked before Node because Bun exposes a Node-compatible process global.
ts
(globals?: GlobalForDetect): Runtime;Examples
ts
const rt = detectRuntime();
// rt === 'node' | 'bun' | 'deno' | 'unknown'