Keywords: cross-container, Hybrid, offline
Absrtact: The main discussion today is the off-line component cross-container scenario, want to understand how the online page across the WebView container, you can see http://www.cnblogs.com/yexiaochai/p/5204847.html this article.
If you don't know what the difference is between offline and online, check the other documentation yourself. I will simply introduce the respective advantages and differences from the code level, not offline and on-line. Take a look at the diagram first:
On the left is the online page, which features a page on the service side. Each container executes the same code, and the code knows in which container it runs only at run time.
On the right is offline page, the feature is that each container has a code in the local, the code is independent, non-interference. In the compiler you will know which container will run.
Different features mean completely different ideas and programs.
Idea: Since the compile time will know which container to run in the future, it is necessary to do some articles in the compiler. First, for different containers, waimai or Nuomi, or, hand hundred, Ctrip, and so on, different containers under the H5 page which is the same, which is not the same.
We know that in the same business, 90% is the same, the main small part of the customization function, and each container of the Jsbridge provided by the interface is not the same.
So, we pull out most of the same business. Added the adapter layer.
Adapter to the business through a unified end-ability interface, and for different containers have different implementations. In this way, the cost of adding one container at a time is only needed for the container, and the adapter can be quickly migrated once again.
FIS3 release Waimai:adapter/waimai + bussiness = Waimai bussiness.
Other components by analogy.
Code path: Https://github.com/liaobin312716/cross-platform-h5-page
At present the code is not very perfect, and mainly the takeaway and glutinous rice components mainly, follow-up will consider more component access.
Cross-container hybrid offline component solution