
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
@cxkit/version-core
Advanced tools
Framework-agnostic runtime core for frontend version update detection and notification.
核心的纯净运行时逻辑库,零前端框架依赖,由 TypeScript 保证类型安全。
它是整个 @cxkit 版本检测体系的心脏,负责接管轮询(Poller)、提取(Fetcher)和状态机(State Machine)流转。所有的 React、Vue 或 Vanilla 适配器其实都是基于对 Checker 事件总线的包装。
fetch 和事件。version.json 请求,解析 buildId 与 buildTime。npm install @cxkit/version-core
createVersionChecker(options: CheckerOptions)初始化一个版本检查器实例,它是全部单向数据流的源头。
import { createVersionChecker } from '@cxkit/version-core'
const checker = createVersionChecker({
pollInterval: 1000 * 60 * 5, // 轮询检查的时间间隔
remindDelay: 1000 * 60 * 60, // 稍后提醒的延迟时间
devMock: false, // 是否开启开发环境 Mock 模式
refreshStrategy: 'auto', // 触发更新后刷新页面的策略
baseUrl: '/', // version.json 的请求基地址
versionUrl: (env) => '...' // 高级:自定义推导版号路径
});
// 订阅事件:每当状态变更时触发
checker.on('state-change', (state) => {
console.log(state.hasPendingUpdate);
});
// 明确检测到了全新的版本发版
checker.on('update-detected', (manifest) => {
console.log("新版本来了!", manifest);
});
// 开启轮询
checker.start();
checker.check(): 挂载立刻执行一次强制检查。checker.confirm(): 接受更新版本通知。通常这会执行你预设或默认的刷新策略并改写本地缓存存储记录。checker.defer(delay?): 稍后提醒。在静默期内,hasPendingUpdate 将保持为假。checker.destroy(): 销毁事件总线及所有计时器轮询,回收内存(通常用于组件销毁生命周期)。完整的 API 定义、高级用法与系统架构解析,请访问 官方开发文档。
FAQs
Framework-agnostic runtime core for frontend version update detection and notification.
The npm package @cxkit/version-core receives a total of 27 weekly downloads. As such, @cxkit/version-core popularity was classified as not popular.
We found that @cxkit/version-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.