本文整理汇总了TypeScript中semver-compare类的典型用法代码示例。如果您正苦于以下问题:TypeScript semver-compare类的具体用法?TypeScript semver-compare怎么用?TypeScript semver-compare使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了semver-compare类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: shouldNagForVersion
export function shouldNagForVersion(version: TriVersionFeedItem) {
const timeSinceRelease = (Date.now() - version.releaseDate.getTime()) / 1000
const updateNagWaitSeconds = Config.get("update", "nagwait") * 24 * 60 * 60
const newerThanInstalled = SemverCompare(version.version, getInstalledPatchVersion()) > 0
return newerThanInstalled && timeSinceRelease > updateNagWaitSeconds
}
开发者ID:antonva,项目名称:tridactyl,代码行数:7,代码来源:updates.ts
示例2: naggedForVersion
export function naggedForVersion(version: TriVersionFeedItem) {
const lastNaggedVersion = Config.get("update", "lastnaggedversion")
if (lastNaggedVersion) {
// If the version is <= the last nagged version, we've already
// nagged for it.
return SemverCompare(version.version, lastNaggedVersion) <= 0
} else {
return false
}
}
开发者ID:antonva,项目名称:tridactyl,代码行数:10,代码来源:updates.ts
示例3: nativegate
export async function nativegate(
version = "0",
interactive = true,
): Promise<Boolean> {
if (
["win", "android"].includes(
(await browser.runtime.getPlatformInfo()).os,
)
) {
if (interactive == true)
logger.error(
"# Tridactyl's native messenger doesn't support your operating system, yet.",
)
return false
}
try {
const actualVersion = await getNativeMessengerVersion()
if (actualVersion !== undefined) {
if (semverCompare(version, actualVersion) > 0) {
if (interactive == true)
logger.error(
"# Please update to native messenger " +
version +
", for example by running `:updatenative`.",
)
// TODO: add update procedure and document here.
return false
}
return true
} else if (interactive == true)
logger.error(
"# Native messenger not found. Please run `:installnative` and follow the instructions.",
)
return false
} catch (e) {
if (interactive == true)
logger.error(
"# Native messenger not found. Please run `:installnative` and follow the instructions.",
)
return false
}
}
开发者ID:larsks,项目名称:tridactyl,代码行数:42,代码来源:native_background.ts
注:本文中的semver-compare类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论