npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cordova-ohos/cordova-plugin-appversion

v1.0.0

Published

Cordova appversion Plugin

Readme

cordova-plugin-appversion

轻量级 Cordova 插件,专注于跨平台获取应用版本信息,支持 Android、iOS、OHOS 等多平台,无需关注底层系统差异。可快速获取应用名称、版本号、构建号、包名(Android)/Bundle ID(iOS)等核心信息,广泛用于应用更新检测、日志上报、用户反馈等场景,帮助开发者实现版本相关的业务逻辑。本文档主要说明在OHOS系统中的应用。

核心特性

  1. 跨平台统一接口:一套代码适配 Android、iOS、OHOS 等主流平台,无需编写平台差异化代码

  2. 全面版本信息获取:支持获取应用名称、版本号(Version Name)、构建号(Build Number)、包名 / Bundle ID 等核心信息

  3. 轻量级设计:插件体积小(仅~50KB),无额外依赖,不增加应用包体积

  4. 快速集成:API 简洁直观,3 行代码即可实现版本信息获取,学习成本低

  5. 实时信息同步:获取的版本信息与应用配置实时同步,无需重启应用即可获取更新后的配置

  6. TypeScript 支持:内置类型定义文件,支持 TypeScript 项目开发,提供类型提示与语法校验

安装指南

1. 基础安装(推荐)

通过 npm 安装最新稳定版,自动集成到 Cordova 项目:

//安装 hcordova
npm install -g hcordova
//全平台安装
hcordova plugin add cordova-plugin-appversion

指定OHOS安装
hcordova plugin add cordova-plugin-appversion --platform ohos

2. 安装指定版本

如需兼容特定 Cordova 或平台版本,可指定版本号:

# 安装 1.0.0 

hcordova plugin add [email protected] --platform ohos

3. 从 GitCode 安装

如需测试最新功能或修复,可从 GitCode 仓库安装开发分支:

hcordova plugin add https://gitcode.com/OpenHarmony-Cordova/cordova-plugin-appversion.git --platform ohos

4. 卸载插件

#全平台卸载
hcordova plugin remove cordova-plugin-appversion

#指定OHOS卸载
hcordova plugin remove cordova-plugin-appversion --platform ohos

快速开始

//通过AppVersion对象获取version和build
function getAppVersion() {
    console.log("version:"+AppVersion.version+",code:"+AppVersion.build);
}

许可证

本插件基于 MIT License 开源,详见 LICENSE 文件。

资源参考

  1. OHOShttps://gitcode.com/OpenHarmony-Cordova/cordova-plugin-appversion

  2. Android、ios插件说明https://www.npmjs.com/package/cordova-plugin-appversion