Ale.js

# Life

### Start

In Ale, a component has six life states, which correspond to their life cycle functions of the same name:

• using (when the component is used)
• mounting (when the component is inserted into the real DOM)
• unmounting (when the component moves out of the real DOM)
• rendering (when the component is rendered)
• updating (when the component is updated)
• destroy (when the component is destroyed)
• staticDataUpdating (when static data is updated)

You can add a property called life when defining a component and add a function to the life property:

In addition to the using function, other functions will automatically bind the Ale component object. If you need to change the data, use the form this.data to change:
The upper timer does not apply Ale’s built-in diff algorithm because you need to wrap elements that don’t need to be updated with DOM tags:
Now you can open the console and compare the refresh of the two instance DOMs. You will find that the Now Time: of this instance is not updated.