Skip to content

Commit 9c8a443

Browse files
committed
fix(platform): Update isWeb to include 'h5' and 'web' platform
1 parent 4196b9d commit 9c8a443

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ export type UtsPlatform = BuiltInPlatform | 'app-android' | 'app-ios' | 'web'
7171
*/
7272
export const utsPlatform = env.UNI_UTS_PLATFORM as UtsPlatform
7373

74-
/** Detect if `process.env.UNI_PLATFORM` is `h5` */
75-
export const isH5 = platform === 'h5'
74+
/** Detect if `process.env.UNI_PLATFORM` is `h5` or if `process.env.UNI_PLATFORM` is `web` */
75+
export const isH5 = platform === 'h5' || platform === 'web'
7676

77-
/** Detect if `process.env.UNI_PLATFORM` is `web` */
78-
export const isWeb = platform === 'web'
77+
/** Detect if `process.env.UNI_PLATFORM` is `web` or if `process.env.UNI_PLATFORM` is `h5` */
78+
export const isWeb = platform === 'web' || platform === 'h5'
7979

8080
/** Detect if `process.env.UNI_PLATFORM` is `app` */
8181
export const isApp = platform === 'app'

0 commit comments

Comments
 (0)