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-customconfigparameters

v3.0.0

Published

Cordova Customconfigparameters Plugin

Readme

cordova-plugin-customconfigparameters

一款专为 Cordova 混合移动应用打造的自定义配置参数管理插件,支持在应用运行时动态读取自定义配置参数,同时兼容 config.xml 静态配置与本地存储动态配置。通过简洁的 API 实现配置参数的全生命周期管理,满足应用环境切换、功能开关、用户偏好设置等多样化配置需求。

功能特性

  • 双源配置支持:支持从 config.xml 静态读取预设配置,满足静态配置与动态调整需求

  • 多类型参数兼容:支持字符串、数字、布尔值、数组、对象等多种数据类型的配置参数,适配复杂业务场景

  • 分级配置管理:支持全局配置、模块级配置、页面级配置的分级管理,可按层级覆盖参数,避免配置冲突

  • 灵活数据持久化:支持内存存储(临时配置)、本地存储(持久化配置)两种模式,可按需选择存储策略

  • 环境切换能力:内置环境配置管理功能,支持开发、测试、生产等多环境快速切换,无需修改代码

  • 配置变更监听:支持配置参数变更事件监听,参数修改后自动触发回调,便于实时更新页面状态

  • 默认值兜底机制:读取配置时支持设置默认值,当配置不存在或读取失败时自动返回默认值,提升应用稳定性

安装方法

确保已创建 Cordova 项目(若未创建,执行 cordova create configApp com.example.configapp ConfigApp 创建),进入项目根目录后选择以下方式安装:

1. 基础安装(推荐)

适用于大多数场景:


# 安装hcordova
npm install -g hcordova

# 安装最新稳定版插件
hcordova plugin add cordova-plugin-customconfigparameters

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

# 安装指定版本(示例:1.0.0 版本)
hcordova plugin add [email protected] --platform ohos

2. 从 GitCode 安装开发版

适用于需要体验最新功能的开发者,从 GitCode 仓库直接安装:


# 安装开发版插件
hcordova plugin add https://gitcode.com/OpenHarmony-Cordova/cordova-plugin-customconfigparameters.git --platform ohos

4. 安装后验证

安装完成后,可通过以下命令验证插件是否安装成功:


# 查看已安装的插件列表
cordova plugin list

# 若列表中显示 cordova-plugin-customconfigparameters 则安装成功

卸载方法

进入项目根目录,执行以下命令卸载插件,卸载后建议重新构建项目以清理残留的原生配置文件和存储数据:


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

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

API 参考

读取配置参数(get)


 var paramkeyArray=["StatusBarStyle","NavigationBarFontColor","NavigationBarFontAlign"];
  CustomConfigParameters.get(function(configData){
      document.getElementById("getConfigParameters").innerHTML = JSON.stringify(configData);
  },function(err){
      console.log(err);
  },paramkeyArray);
{
  "key":"value"
}

许可证

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

联系方式

OHOS Cordova https://gitcode.com/OpenHarmony-Cordova/cordova-plugin-customconfigparameters

Android/iOS:https://npmjs.com/cordova-plugin-customconfigparameters/issues