Hi,
Using dict of functions as objects, I don't happen to retrieve from job handler cmdlauncher#exit_cb the var obj._jobi " Job index.
Is there anyway to retrieve this var's value without setting it as global ?
Thanks
Niva
" Use Case
let x = cmdlauncher#new()
call x.add_cmd(cmd1)
call x.add_cmd(cmd2)
call x.showcmds()
call x.startjob()
"/////////////// objects
function! cmdlauncher#new() "{{{
let obj = {}
let obj._cmds = [] " Job command
let obj._jobs = [] " Job object
let obj._jobi = 0 " Job index <<<<< how to access it from handler
function! obj.startjob() "{{{
let cmd = 'cmd /k '.self._cmds[self._jobi]
call add (self._jobs, job_start(cmd, {
\ 'exit_cb' : 'cmdlauncher#exit_cb',
\ 'close_cb' : 'cmdlauncher#close_cb',
\ 'callback' : 'cmdlauncher#callback'
\ })
\)
let ch = job_getchannel(self._jobs[-1])
endfunction "}}}
return obj
endfunc
function! cmdlauncher#exit_cb(job, status) "{{{
try
echomsg "job exit with : ".string(a:job.' '.a:status)
>>>>>> echomsg self._jobi "<< KO
catch E716
" No-op if data isn't ready
endtry
endfunction "}}}
"//////////////////////////////
--
--
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.
For more options, visit https://groups.google.com/d/optout.
Tuesday, May 2, 2017
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment