0.0.20 • Published 2 years ago

uclean-hot-code-push-plugin v0.0.20

Weekly downloads
1
License
MIT
Repository
-
Last release
2 years ago

插件安装与卸载

卸载插件

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,
}
0.0.20

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.14

3 years ago

0.0.15

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago