On 2023-12-09, Nicolas <nivaemail@gmail.com> wrote:
> Hi all,
>
> According to Bram example in the job's help now,
> Is it possible to pass additional parameters to job's handlers callback in
> vim9script ?
Yes. See, for instance, $VIMRUNTIME/autoload/typeset.vim, in particular
the Callbacks section and the Typeset() function.
> This minimal example with additional params:
> def Compress_OnExit(job_id: job, exit_status: number, foo: string): void
> echom 'Job OnExit ' .. job_id->string() .. ' exited with status ' ..
> exit_status
> # Compress_CopyToDrive('PATRIOT')
> enddef
> var job = job_start(cmd, { 'exit_cb': function('Compress_OnExit',
> ['foo']) } )
That should be:
var job = job_start(['ls'], {
exit_cb: (j, e) => Compress_OnExit(j, e, 'foo')
})
Hope this helps,
Life.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/ul553q%24puu%241%40ciao.gmane.io.
Sunday, December 10, 2023
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment