Ale.js

# Plugin

### Using plugins

We need to load a plugin using the Ale.use function:

The Ale.use function takes a parameter to specify the Ale plugin object to load. For example, we pass in an Ale plugin object named test:

test is actually a variable. In the following sections, we will learn how to make an Ale plugin object.

### Making plugins

First let’s define an object:

If you want test to be an Ale plugin object, then it must have at least the name and install attributes:

You can add functions or properties to the letotype property of the Ale object in the install property…

Anyway, the installer supports arbitrary JavaScript code!

#### Plugin object

Call any content inside the plugin via the Ale.plugin.function name format.

The functions currently built into the plugin object are as follows:

• inject() [The inject function takes a parameter, the type needs to be function, which is used to inject content into the component (it will be triggered whenever the component is rendered)]
• mixin() [mixin is triggered when the component is defined, and the injection is triggered when the component is rendered (using the same way as injection)]

### Online instance

We have defined an Ale plugin object called test, now let’s install it by typing Ale.use(test) in the console! (Hello will be output during installation!)

Found some errors? Edit on Github!