Error correction

This commit is contained in:
Badr AZIZBI 2016-11-04 15:47:45 +01:00
parent 8496a9bebd
commit a2afe2fa1a
2 changed files with 19 additions and 20 deletions

View File

@ -16,19 +16,19 @@ Or globally:
## Documentation
### The life cycle of plugins
### Plugin life cyle
#### First step: Initialising plugins
#### Initialization
When the xo-server start, he initialize and load plugins. Then, he recuperates the configuration schema and the test schema to store them.
When xo-server starts, it initializes and loads plugins. Then, he recuperates the configuration schema and the test schema to store them.
#### Second step: Get schemas
#### Get schemas
The xo-web recuperates the configuration schema and the test schema from xo-server to generate a UI.
#### Third step: Test configuration schema
#### Test configuration
Xo-web send an object which contains the configuration schema and the test schema to xo-server for testing the configuration and saving it if successful.
Xo-web send data to xo-server for testing the configuration and saving it if successful.
### Principal Methods
@ -37,23 +37,21 @@ Xo-web send an object which contains the configuration schema and the test schem
It is just a factory function which will create an instance of the plugin. Usually it will be called only once, at startup.
Its only parameter is an object which currently only contains the instance of the currently running xo-server.
#### Configure
#### `configure(configuration) `
This method is called each time the plugin is (re-configured).
Its only parameter is an object which contains the values putted on the confirmation form.
#### Load
This method is called each time the plugin is (re-)configured.
Its only parameter is an object which contains the configuration values.
#### `load() `
This method is called to load the plugin.
#### Unload
#### `unload() `
This method is called to unload the plugin.
#### Test
#### `test(data) `
This method is called if the test option is activated.
Its only parameter is an object which contains the values putted on the test form.
Its only parameter is an object which contains the test values.

View File

@ -66,12 +66,13 @@ exports.default = function (opts) {
},
// This (optional) method is called to test the configuration of the plugin.
// Note 1: will only be called if the plugin has been successfully configured.
// Note 1: will only be called if the plugin has been successfully configured and is loaded.
// Note 2: before being called, the test configuration is validated
// against the provided test configuration schema.
// against the provided test data.
// Note 3: will only be called if the test option is activated.
test: function(data){
console.log('the configuration is valid')
test: function (data) {
console.log('the configuration is about to be tested')
// TODO: test the configuration, i.e, use the main feature of the plugin and throws any errors.
}
}
}