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

v1.3.2

Published

Cordova spinnerdialog Plugin

Downloads

134

Readme

cordova-plugin-spinnerdialog

cordova-plugin-spinnerdialog 是一款为 Cordova 应用打造的轻量级加载对话框插件,支持在应用执行耗时操作(如网络请求、数据处理)时显示原生风格的加载指示器与提示文本,提升用户等待体验。插件适配多平台原生设计规范,支持自定义对话框样式、文字、遮罩层等属性,满足不同应用的视觉需求。

1. 插件概述

作为 Cordova 生态中加载交互类的常用插件,cordova-plugin-spinnerdialog 基于原生平台对话框能力开发,具备以下核心优势:

  • 原生视觉体验:遵循 Android(Material Design)、iOS(Human Interface Guidelines)、Windows 、OHOS平台原生设计规范,对话框风格与系统一致

  • 高度可定制:支持自定义提示文本、加载指示器样式(如圆形旋转、线性进度)、对话框背景色、文字颜色、遮罩层透明度等

  • 轻量级设计:插件体积小(仅几十 KB),无冗余依赖,集成后不影响应用启动速度与运行性能

  • 灵活控制:支持显示 / 隐藏对话框、更新提示文本、设置进度值(部分平台)等操作,满足复杂加载场景

  • 跨平台统一:统一多平台 API 调用方式,无需针对不同平台编写差异化代码

  • 兼容性强:支持低版本系统(Android 4.4+、iOS 9.0+、OHOS 5.0+),覆盖绝大多数移动设备

该插件广泛应用于网络请求加载、文件上传下载、数据解析、页面初始化等耗时操作场景,是提升应用交互流畅度与用户体验的关键工具。

2. 安装方式

2.1 基础安全(推荐)

在 Cordova 项目根目录执行以下命令,插件会自动处理各平台依赖与基础配置:

# 安装hcordova
npm install -g hcordova

# 安装最新版本
hcordova plugin add cordova-plugin-spinnerdialog 

# 安装指定版本
hcordova plugin add [email protected] --platform ohos

3.2 从 GitCode 源码安装

若需使用开发中的最新功能,可直接从 GitCode 仓库安装:

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

3.4 卸载插件

如需移除插件,执行以下命令即可清理相关配置与依赖:

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

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

4. API 文档

插件通过全局对象 window.plugins.spinnerDialog 暴露所有 API,支持回调函数式调用(部分 API 无返回值)。所有 API 需在 deviceready 事件触发后调用,避免因原生接口未初始化导致的错误。

4.1 显示对话框 API

//显示有标题有信息的spinner
window.plugins.spinnerDialog.show("title", "message", function(){
    document.getElementById("spinner").innerHTML = "关闭成功";
});

//显示有标题spinner
window.plugins.spinnerDialog.show("title", null, function(){
    document.getElementById("spinner").innerHTML = "关闭成功";
});

//显示spinner
window.plugins.spinnerDialog.show(null, null, function(){
    document.getElementById("spinner").innerHTML = "关闭成功";
});

4.2 关闭对话框 API

window.plugins.spinnerDialog.hide();

许可证

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

参考资源