15 lines
466 B
TypeScript
15 lines
466 B
TypeScript
/**
|
|
* Utility function to check if code is running on server or client
|
|
* @returns true if running on server (SSR), false if running on client (browser)
|
|
*/
|
|
export function isServer(): boolean {
|
|
return typeof window === 'undefined';
|
|
}
|
|
|
|
/**
|
|
* Utility function to check if code is running on client
|
|
* @returns true if running on client (browser), false if running on server (SSR)
|
|
*/
|
|
export function isClient(): boolean {
|
|
return typeof window !== 'undefined';
|
|
} |