uclean-hot-code-push-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.0.20 • Public • Published

插件安装与卸载

卸载插件

npm uninstall uclean-hot-code-push-plugin

安装插件

npm install uclean-hot-code-push-plugin

在android/app/src/main/java/com/ujing/franchisee/MainActivity.java 的init方法中增加 add( UcleanHotUpdatePlugin.class );

this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
  // Additional plugins you've installed go here
  // Ex: add(TotallyAwesomePlugin.class);
  add( UcleanHotUpdatePlugin.class );
}});

js调用方法

初始化热更插件,判断是读取程序内文件还是SD卡/沙盒内文件

const { UcleanHotUpdatePlugin } = Capacitor.Plugins;
const result = await UcleanHotUpdatePlugin.initJSResource();
返回值格式
{
  errorCode: string,
  errorMessage: string,
}

下载JS文件

const { UcleanHotUpdatePlugin } = Capacitor.Plugins;
const result = await UcleanHotUpdatePlugin.downloadJSFile({ url: string });
参数
{
  url: string, // 文件下载路径
}
返回值格式
{
  errorCode: string, // '0'下载完成,其他下载失败
  errorMessage: string
  }

监听下载进度变化

const { UcleanHotUpdatePlugin } = Capacitor.Plugins; const progressListener = UcleanHotUpdatePlugin.addListener('progressDidChanged',(result) => { //progress:result.progress })

移除监听方法

progressListener.remove()

result返回值格式
{
   progress: Int
}

覆盖安装旧版本

const { UcleanHotUpdatePlugin } = Capacitor.Plugins;
const result = await UcleanHotUpdatePlugin.installJSFile();
返回值格式
{
  errorCode: string,
  errorMessage: string,
}

Readme

Keywords

Package Sidebar

Install

npm i uclean-hot-code-push-plugin

Weekly Downloads

18

Version

0.0.20

License

MIT

Unpacked Size

247 kB

Total Files

89

Last publish

Collaborators

  • jadejiang