isBrowser

isBrowser

Returns true when runtime is a browser.

Import

import { isBrowser } from '@fullstacksjs/toolbox';

Signature

function isBrowser(): boolean {}

Examples

if (isBrowser()) alert('I will run in the client only');
if (!isBrowser()) console.log('This runs in server environment');