mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 04:01:20 -08:00
feat: enforce browser environment for Artplayer initialization
- Added a check in the Artplayer constructor to throw an error if instantiated outside a browser environment. - Updated the isBrowser utility to ensure both window and document are defined. - Removed unused user agent checks for WeChat, IE, and Android from compatibility utilities. - Updated TypeScript definitions to reflect the removal of unused properties. - Added a basic test case for Artplayer initialization in SSR context.
This commit is contained in:
1 parent
3a2dcdb226
commit
e834246641
9 files changed
+14
-14
No files matched your search
@@ -1,9 +1,6 @@
|
||||
export const userAgent = globalThis?.CUSTOM_USER_AGENT ?? (typeof navigator !== 'undefined' ? navigator.userAgent : '')
|
||||
export const isSafari = /^(?:(?!chrome|android).)*safari/i.test(userAgent)
|
||||
export const isWechat = /MicroMessenger/i.test(userAgent)
|
||||
export const isIE = /MSIE|Trident/i.test(userAgent)
|
||||
export const isAndroid = /android/i.test(userAgent)
|
||||
export const isIOS = /iPad|iPhone|iPod/i.test(userAgent) && !window.MSStream
|
||||
export const isIOS13 = isIOS || (userAgent.includes('Macintosh') && navigator.maxTouchPoints >= 1)
|
||||
export const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent) || isIOS13
|
||||
export const isBrowser = typeof window !== 'undefined'
|
||||
export const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'
|
||||
Reference in new issue
Block a user