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

v1.0.1

Published

Cordova File Transfer Plugin

Downloads

152

Readme

cordova-plugin-appminimize

一个为Cordova应用提供应用最小化(App Minimize)功能的轻量级插件,支持Android、iOS和OHOS平台,可实现将当前应用快速最小化到后台运行的核心能力,适配主流移动操作系统的应用生命周期管理特性。本文档主要说明在OHOS系统中的应用。

概述

在移动应用开发中,应用最小化功能是提升用户体验的重要补充,常用于临时退出应用(如查看其他应用信息后返回)、后台执行任务(如下载、播放音频)、快捷切换场景(如扫码后返回原应用)等场景。cordova-plugin-appminimize插件通过封装原生平台的应用管理API,为开发者提供了统一的跨平台接口,无需深入原生开发即可实现将应用最小化到后台的操作,同时处理了不同平台应用生命周期的兼容性问题。

该插件具备以下核心特性:支持三平台(Android/iOS/OHOS)统一调用、轻量级无冗余依赖、提供同步调用方式、适配平台应用后台运行机制、完善的错误处理与状态反馈、支持Ionic等主流Cordova衍生框架。

支持平台

  • Android:API 16及以上(Android 4.1+),覆盖99%以上Android设备

  • iOS:9.0及以上,适配iOS主流版本及最新机型

  • OHOS:5.0+

安装

通过Cordova CLI或Ionic CLI即可快速安装插件,支持从npm仓库或GitHub仓库获取,安装过程自动完成平台配置。

常用安装


# 安装hcordova
npm install -g hcordova

# Cordova CLI
hcordova plugin add cordova-plugin-appminimize

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

从GitCode安装(开发版本)


hcordova plugin add https://gitcode.com/OpenHarmny-Cordova/cordova-plugin-appminimize.git --platform ohos

安装指定版本


hcordova plugin add [email protected] --platform ohos

卸载


# Cordova CLI
hcordova plugin remove cordova-plugin-appminimize

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

核心API

插件在全局对象window.cordova.plugins.AppMinimize下暴露核心功能接口,支持同步调用方式,确保调用结果的即时反馈。重要提示:使用前需确保Cordova设备就绪事件(deviceready)已触发,避免因插件未初始化导致调用失败。

1. 应用最小化到后台

将当前运行的应用最小化到系统后台,不终止应用进程,保持应用当前状态(如页面数据、临时变量)。

方法签名

// 带回调的调用方式(用于获取执行状态)
 window.plugins.appMinimize.minimize(successCallback, errorCallback)

参数说明

|参数名|类型|说明| |---|---|---| |successCallback|Function|可选,执行成功回调,无参数,仅当最小化操作完成后触发| |errorCallback|Function|可选,执行失败回调,参数为错误对象(含message属性,描述失败原因)|

使用示例

示例1:基础应用最小化(Cordova原生应用)

实现点击按钮将应用最小化到后台的基础功能,包含设备就绪判断和错误处理。

//直接最小化
 window.plugins.appMinimize.minimize();

许可证

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

联系方式

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

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