@hylid/env
Advanced tools
Comparing version 3.0.0-alpha.4 to 3.0.0-alpha.7
import { ClientEnv, PlatformEnv } from './types'; | ||
declare let client: string | undefined; | ||
declare let platform: string | undefined; | ||
export declare function getDefaultDiscernEnv(): { | ||
client: string | undefined; | ||
platform: string | undefined; | ||
}; | ||
declare let client: string | undefined, platform: string | undefined; | ||
interface CustomEnv { | ||
@@ -5,0 +8,0 @@ client?: string; |
import { createCommonEnv, getSettingName, isMP, notice } from "./utils"; | ||
import { getName4MP, getName4MpWeb, getName4Web } from "./getClientName"; | ||
import { CLIENT, PLATFORM } from "./constants"; | ||
var client; | ||
var platform; | ||
if (isMP()) { | ||
client = getName4MP(); | ||
platform = PLATFORM.MP; | ||
} else { | ||
var setting = getSettingName(); | ||
if (setting.platform) { | ||
platform = setting.platform; | ||
client = setting.client || (platform === 'mpweb' ? getName4MpWeb() : getName4Web()); | ||
export function getDefaultDiscernEnv() { | ||
var client; | ||
var platform; | ||
if (isMP()) { | ||
client = getName4MP(); | ||
platform = PLATFORM.MP; | ||
} else { | ||
// 如果只设置了 client,默认是套壳场景 | ||
client = setting.client || getName4MpWeb(); | ||
if (client) { | ||
platform = PLATFORM.MPWEB; | ||
var setting = getSettingName(); | ||
if (setting.platform) { | ||
platform = setting.platform; | ||
client = setting.client || (platform === 'mpweb' ? getName4MpWeb() : getName4Web()); | ||
} else { | ||
client = getName4Web(); | ||
platform = PLATFORM.WEB; | ||
// 如果只设置了 client,默认是套壳场景 | ||
client = setting.client || getName4MpWeb(); | ||
if (client) { | ||
platform = PLATFORM.MPWEB; | ||
} else { | ||
client = getName4Web(); | ||
platform = PLATFORM.WEB; | ||
} | ||
} | ||
} | ||
if (!platform || !client) { | ||
notice('Cannot identify your client.'); | ||
} | ||
return { | ||
client: client, | ||
platform: platform | ||
}; | ||
} | ||
if (!platform || !client) { | ||
notice('Cannot identify your client.'); | ||
} | ||
var _a = getDefaultDiscernEnv(), | ||
client = _a.client, | ||
platform = _a.platform; | ||
export function customEnv(config) { | ||
@@ -29,0 +38,0 @@ var custom = typeof config === 'function' ? config({ |
{ | ||
"name": "@hylid/env", | ||
"version": "3.0.0-alpha.4", | ||
"version": "3.0.0-alpha.7", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10406
320