Skip to content

@utilslib/web/IS_BROWSER

IS_BROWSER

函数签名

typescript
function IS_BROWSER() { ... }
点击查看源码
js
// ============ 内部函数 ============
/**
 * 检测浏览器环境
 * @returns 浏览器环境判断结果
 */
function isBrowser() {
  return typeof window !== "undefined" && typeof navigator !== "undefined";
}
// ============ 环境检测 ============
/** 浏览器环境 */
export const IS_BROWSER = isBrowser();
ts
// ============ 内部函数 ============

/**
 * 检测浏览器环境
 * @returns 浏览器环境判断结果
 */
function isBrowser() {
  return typeof window !== "undefined" && typeof navigator !== "undefined";
}

// ============ 环境检测 ============
/** 浏览器环境 */
export const IS_BROWSER = isBrowser();

如有错误,请提交issue :::