mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 08:21:32 +00:00
Extend API documentation
This commit is contained in:
parent
48c3df621b
commit
806623c80d
48
README.md
48
README.md
@ -123,6 +123,8 @@ APIs exposed by our pre-witten event handlers are documented here.
|
||||
|
||||
### IdeEventHandler
|
||||
|
||||
This event handler is responsible for reading and writing files shown in the frontend code editor.
|
||||
|
||||
You can read the content of the currently selected file like so:
|
||||
```
|
||||
{
|
||||
@ -184,6 +186,8 @@ Overwriting the current list of excluded file patterns is possible with this mes
|
||||
|
||||
### TerminalEventHandler
|
||||
|
||||
Event handler responsible for running a backend for `xterm.js` to connect to (frontend terminal backend).
|
||||
|
||||
By default callbacks on terminal history are invoked *as soon as* a command starts to execute in the terminal (they do not wait for the started command to finish, the callback may even run in paralell with the command).
|
||||
|
||||
If you want to wait for them and invoke your callbacks *after* the command has finished, please set the `TFW_DELAY_HISTAPPEND` envvar to `1`.
|
||||
@ -217,6 +221,8 @@ You can read terminal command history like so:
|
||||
|
||||
### ProcessManagingEventHandler
|
||||
|
||||
This event handler is responsible for managing processes controlled by supervisord.
|
||||
|
||||
Starting, stopping and restarting supervisor processes can be done using similar messages (where `command` is `start`, `stop` or `restart`):
|
||||
```
|
||||
{
|
||||
@ -231,6 +237,8 @@ Starting, stopping and restarting supervisor processes can be done using similar
|
||||
|
||||
### LogMonitoringEventHandler
|
||||
|
||||
Event handler emitting real time logs (`stdout` and `stderr`) from supervisord processes.
|
||||
|
||||
To change which supervisor process is monitored use this message:
|
||||
```
|
||||
{
|
||||
@ -257,6 +265,8 @@ To set the tail length of logs (the monitor will send back the last `value` char
|
||||
|
||||
### FSMManagingEventHandler
|
||||
|
||||
This event handler controls the TFW finite state machine (FSM).
|
||||
|
||||
To attempt executing a trigger on the FSM use (this will also generate an FSM update message):
|
||||
```
|
||||
{
|
||||
@ -292,3 +302,41 @@ This event handler broadcasts FSM update messages after handling commands in the
|
||||
}
|
||||
```
|
||||
|
||||
### DirectorySnapshottingEventHandler
|
||||
|
||||
Event handler capable of taking and restoring snapshots of directories (saving and restoring directory contens).
|
||||
|
||||
You can take a snapshot of the directories with the following message:
|
||||
```
|
||||
{
|
||||
"key": "snapshot",
|
||||
"data" :
|
||||
{
|
||||
"command": "take_snapshot"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To restore the state of the files in the directories use:
|
||||
```
|
||||
{
|
||||
"key": "snapshot",
|
||||
"data" :
|
||||
{
|
||||
"command": "restore_snapshot",
|
||||
"value": ...date string (can parse ISO 8601, unix timestamp, etc.)...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
It is also possible to exclude files that match given patterns (formatted like lines in `.gitignore` files):
|
||||
```
|
||||
{
|
||||
"key": "snapshot",
|
||||
"data" :
|
||||
{
|
||||
"command": "exclude",
|
||||
"value": ...list of patterns to exclude from snapshots...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user