@ace-util/core
Version:
Utils.
49 lines (48 loc) • 1.85 kB
TypeScript
export declare function isWechat(ua?: string): boolean;
export declare function isWechatWork(ua?: string): boolean;
export declare function isWeibo(ua?: string): boolean;
export declare function isQQ(ua?: string): boolean;
export declare function isAlipay(ua?: string): boolean;
export declare function isDingTalk(ua?: string): boolean;
export declare function isFeiShu(ua?: string): boolean;
export declare function isDouyin(ua?: string): boolean;
export declare function isMoible(ua?: string): boolean;
export declare function isIOS(ua?: string): boolean;
export declare function isAndroid(ua?: string): boolean;
export declare function isHarmonyOS(ua?: string): boolean;
export declare type MobileDeviceType = {
type: 'mobile' | 'ios' | 'android' | 'harmonyos';
env?: 'wechat' | 'wxwork' | 'alipay' | 'dingtalk' | 'feishu' | 'douyin' | 'weibo' | 'qq';
masklayer?: boolean;
};
export declare type PcDeviceType = {
type: 'pc';
env?: 'wechat' | 'wxwork' | 'dingtalk' | 'feishu' | 'douyin' | 'weibo' | 'qq';
};
export declare type DeviceType = MobileDeviceType | PcDeviceType;
/**
* 获取设备类型
* @param {*} ua ,就是userAgent
* @returns type: 设备类型
* env: 访问环境(微信/微博/qq)
* masklayer: 就是给外部拿到判断是否显示遮罩层的,一些特殊环境要引导用户到外部去打开访问
*/
export declare function deviceType(ua?: string): DeviceType;
export declare enum BrowserType {
IE = "ie",
Edge = "edge",
Firefox = "firefox",
Chrome = "chrome",
Opera = "opera",
Safari = "safari"
}
/**
* 获取浏览器类型
* @param {*} ua ,就是userAgent
* @returns type: 浏览器类型
* version: 浏览器版本
*/
export declare function browserType(ua?: string): {
type?: BrowserType;
version?: string;
};