cool hit counter Applet Life Cycle_Intefrankly

Applet Life Cycle


Applets are not HTML5 applications, but more of a traditional CS architecture, which is based on a data-driven model where everything is a component (view component). Here's how the applet compares to a regular Web App. ordinary HTML5 are executed in the browser's host environment, The browser provides window、document etc. BOM targets, But the applet doesn't window、document, It's more like a similar Node.js of the host environment; Therefore it is not possible to use within the applet document.querySelector this kind (of) DOM picker, Nor does it support XMLHttpRequest、location、localStorage etc. that these browsers provide API, Can only be implemented using the applet itself API The applet is not directly accessible through URL interviewed, Instead, communication and session management is done through channel services, So it doesn't support Cookie storage, Simultaneous access to resources using wx.request then there is no cross-domain problem The applet is in JavaScript The modularity of the support on the CommonJS, pass (a bill or inspection) require loaded, with Node.js resemble The page style of the applet is fully inherited from the CSS grammatical, But there will be less on top of the selector, Layout support flex disposition The overall framework of the applet uses a state-oriented programming approach In the view of the API, the state management adopts a Redux-like design approach; one-way data binding approach, when the View is operated by Action, the View can only be updated through the business processing of Action.

The applet lifecycle includes the lifecycle of the application (logical layer App Service) and the lifecycle of the page (view layer View), both of which support different events, as detailed in this accompanying image in the official documentation.

Having mastered the above elements of how applets are implemented, it's good to look at the life cycle of an applet. When the applet starts, two threads are started at the same time, a WebView for page rendering (actually more than one, explained later) and a JavaScriptCore for logic. After initialization, the logic layer passes the initialization data (global data in app.js) through JSBridge to the rendering layer for rendering, and the rendering layer communicates with the logic layer after the WebView page is rendered. Understanding the applet architecture and launch process, the entire lifecycle of the applet can be easily understood just by looking at the flowchart above.

Article Content Reference https://juejin.im Nuggets


Recommended>>
1、Technology Key Technologies for Big Data
2、Setting up jupyternotebook with remote access
3、Python Brush Janes Book Views Reads Happy Dragon Boat Festival Stay up late for the World Cup and brush up to 10k first Simple crawler commonpy
4、Small PHP mistakes that are easy to make and the corresponding analysis
5、React Toss 11 Combining Antd Menu Control Recursive Traversal Component and General Optimization

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号