Giter Site home page Giter Site logo

hotfix's Introduction

cordova-plugin-hotpatch

这个插件定义了一个全局对象 hotpatch object,整个方法当前版本只暴露出一个方法updateNewVersion,调用该方法传入一个 www.zip的下载地址,之后插件会自动下载,并解压

    <script type="text/javascript" src="js/index.js"></script>
    <script type="text/javascript">
			
		        //hotpatch.updateNewVersion("http://10.211.131.232:8080/www.zip");

    		    
    </script>

Installation

cordova plugin add xxxxxxxxx

Supported Platforms

  • Android
  • iOS

安装步骤

1 添加插件
2 在需要更新的时候调用更新地址
3 注意 android平台由于特殊性 ,需要打开主工程的mainActivity 文件,在{
super.onCreate(savedInstanceState);后面加上一行代码  init();
将DownLoadTask.java 文件中的import com.hand.download.R;  改为自己主工程MainActivity 文件 所在路径
如:agelocme-frontend\platforms\android\src\com\nuskin\agelocmeprod\MainActivity.java
则改为import com.nuskin.agelocmeprod.R;
4 安卓和ios需要打不同的www.zip包。安卓zip包需要取assets下面的www文件夹,ios的zip包需要取platforms/ios/www

#### 补充说明
在android平台上的热更新原理:加了init()后,当前app会优先执行从服务器下载到手机端的www文件内的代码,若是没有加init(),热更新不会失效,app重启后会执行原来打包的代码。

热更新的优缺点

优点:避免了繁琐的打包过程
热更新的www代码不会放到公众服务器上。

hotfix's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.