🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@cxkit/version-vanilla

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cxkit/version-vanilla

Vanilla JS adapter for @cxkit/version-core with built-in DOM UI.

latest
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

@cxkit/version-vanilla

为 jQuery、传统服务端渲染模板页面(JSP/PHP/Thymeleaf)、或未引入 React/Vue 等重型抽象库的原生网页开发的微前端/原生级版本热更插件。

这不仅是适配层,也是整个体系架构中最接近浏览器的纯净 DOM 实现版本。底层使用 document.createElement 与原生 CSS 解析事件。

安装

npm install @cxkit/version-vanilla

快速入口用法

它的调用极其简单粗暴,你只需要把它插入到任意 script、文件最上方,或者甚至是通过打包工具单独塞进去的一个 chunk 即可,它会自动附加在 body 最末端。

import { mountVersionUpdateUI } from '@cxkit/version-vanilla'
// 你只需要自行引入 CSS(内部支持按需渲染逻辑,不打包 CSS string)
import '@cxkit/version-vanilla/style.css' 

mountVersionUpdateUI({
  // core 底层共享属性:
  pollInterval: 1000 * 60 * 5,
  devMock: false,
  
  // 原生适配器独享 UI 属性:
  title: '发现新版本',
  message: '我们已向生产服务器发布新的内容代码,由于浏览器存在缓存机制,建议点击立即更新。',
  confirmText: '刷新内容',
  cancelText: '取消',
  
  // 当 UI 卡片被生成并插入的回调
  onMounted: () => console.log('UI injected')
})

阅读完整文档

详细接入流程请访问 官方开发文档

Keywords

vanilla-js

FAQs

Package last updated on 26 Mar 2026

Did you know?

Socket

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.

Install

Related posts