@dtinsight/dt-utils
Version:
32 lines (31 loc) • 777 B
TypeScript
/**
* 检查设备是否为移动设备。
*
* @category 环境检测
* @description
* 该函数使用 http://detectmobilebrowsers.com/ 提供的正则表达式模式来识别移动设备,包括
* 智能手机、平板电脑和其他移动平台。
*
* @returns {boolean} 如果设备是移动设备则返回 `true`,否则返回 `false`。
*
* @example
* ```typescript
* import { isMobile } from 'dt-utils';
*
* // 在桌面浏览器上
* isMobile(); // => false
*
* // 在 iPhone 上
* isMobile(); // => true
*
* // 在 iPad 上
* isMobile(); // => true
*
* // 在非浏览器环境中运行时
* isMobile(); // => false
* ```
*
* @see {@link http://detectmobilebrowsers.com/}
*/
declare const isMobile: () => boolean;
export default isMobile;