feat(ui): new hooks for plugins

This commit is contained in:
Guillaume Chau
2018-06-11 01:53:01 +02:00
parent 8fae98e7ce
commit 8ba6bcfe7b
16 changed files with 297 additions and 25 deletions

View File

@@ -1075,6 +1075,66 @@ api.onPluginReload((project) => {
})
```
### onConfigRead
Called when a configuration screen is open or refreshed.
```js
api.onConfigRead(({ config, data, onReadData, tabs, cwd }) => {
console.log(config.id)
})
```
### onConfigWrite
Called when the user saves in a configuration screen.
```js
api.onConfigWrite(({ config, data, changedFields, cwd }) => {
// ...
})
```
### onTaskOpen
Called when the user open a task details pane.
```js
api.onTaskOpen(({ task, cwd }) => {
console.log(task.id)
})
```
### onTaskRun
Called when the user run a task.
```js
api.onTaskRun(({ task, args, child, cwd }) => {
// ...
})
```
### onTaskExit
Called when a task exists. It can be called both called on success or failure.
```js
api.onTaskExit(({ task, args, child, signal, code, cwd }) => {
// ...
})
```
### onViewOpen
Called when the users open a view (like 'Plugins', 'Configurations' or 'Tasks').
```js
api.onViewOpen(({ view, cwd }) => {
console.log(view.id)
})
```
## Public static files
You may need to expose some static files over the cli-ui builtin HTTP server (typically if you want to specify an icon to a custom view).