Ale.js

Watch

Start

The Watch parameter is strictly a specification that developers (especially plug-in developers) should follow.

It is used to interact with plugins. That is, the plugin can arbitrarily call any information that exists in the Watch parameter.

Plugin user

You only need to add a parameter called watch when defining the component:

1
2
3
4
5
6
Ale("test", {
/* ... */
watch: {
/* Add information that needs to interact with the plugin here. */
}
})

For details on the specific watch parameter, please see the tutorial documentation for the plugin used.

Plugin developer

If you haven’t seen the plugin tutorial, please visit this tutorial first.


When you inject any component, you can get the watch property of the component by returning the watch property inside the ale component object:

1
2
3
4
Ale.plugin.inject(function(obj){
/* Obj is the ale component object when rendered by the registered component */
console.log(obj.watch);
})

Found some errors? Edit on Github!