Skip to content

Commit 61575ef

Browse files
committed
doc: add information about callbacks
1 parent dcea003 commit 61575ef

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

doc/rest-nvim.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ CONTENTS *rest-nvim-contents*
2121
3. Import body from external file......|rest-nvim-usage-external-files|
2222
4. Environment Variables........|rest-nvim-usage-environment-variables|
2323
5. Dynamic Variables................|rest-nvim-usage-dynamic-variables|
24+
6. Callbacks................................|rest-nvim-usage-callbacks|
2425
5. Known issues..........................................|rest-nvim-issues|
2526
6. License..............................................|rest-nvim-license|
2627
7. Contributing....................................|rest-nvim-contributing|
@@ -220,6 +221,22 @@ You can extend or overwrite built-in dynamic variables, with the config key
220221
` },`
221222
`})`
222223

224+
===============================================================================
225+
CALLBACKS *rest-nvim-usage-callbacks*
226+
227+
rest.nvim fires different events upon requests:
228+
- a User RestStartRequest event when launching the request
229+
- a User RestStopRequest event when the requests finishes or errors out
230+
231+
vim.api.nvim_create_autocmd("User", {
232+
pattern = "RestStartRequest",
233+
once = true,
234+
callback = function(opts)
235+
print("IT STARTED")
236+
vim.pretty_print(opts)
237+
end,
238+
})
239+
223240

224241
===============================================================================
225242
KNOWN ISSUES *rest-nvim-issues*

0 commit comments

Comments
 (0)