Skip to content

Commit f74f844

Browse files
committed
perf: improve type
1 parent 87cc78b commit f74f844

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/getUa.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
* @returns {IUa} IUa
44
*/
55

6-
type IUa =
6+
const ua = window.navigator.userAgent.toLowerCase()
7+
8+
export function getUa():
79
| 'ios'
810
| 'android'
911
| 'wechat'
@@ -12,11 +14,7 @@ type IUa =
1214
| 'dingding'
1315
| 'feishu'
1416
| 'mobile'
15-
| undefined
16-
17-
const ua = window.navigator.userAgent.toLowerCase()
18-
19-
export function getUa(): IUa {
17+
| undefined {
2018
/** ios */
2119
if (/iphone|ipod|ipad/i.test(ua)) {
2220
return 'ios'

0 commit comments

Comments
 (0)