Hi,
I'am starting a job and then starting a FunRef by timer_start in order to check when job is dead to to next job.
It appears that timer_stop( from inside the callback Func is not working meanwhile it works when called from the main block code just after the timer_start.
fu! g:jobsManager.SequencingCallBack(timer) "{{{
" if self.GetCurrentJobStatus()=='dead'
if 1
echo "Sequence Handler stopped " . strftime("%T")
call timer_stop(self.sequenceTimer) " THAT DOES NOT WORK :( :(
endif
endf"}}}
fu! g:jobsManager.SequencingJobs() "{{{
echo "Sequence Launched " . strftime("%T")
" Launching Current Job
call self.StartCurrentJob()
" Launching Callback Function to check for next job
let FuncRef = self.SequencingCallBack
let self.sequenceTimer = timer_start(1000,FuncRef, {'repeat': 15})
" call timer_stop(self.sequenceTimer) " THAT WORKS :( :(
" echo self.GetCurrentJobHandle()
" echo self.GetCurrentJobStatus()
endfu
"}}}
Notice that self.sequenceTimer is just set/let from the SequencingJobs func that is a member of a g:jobManager dict/class and it is not initialized at instance.
let g:BaseClass = {} "{{{
fu! g:BaseClass.New(...) "{{{
let newObj = copy(self)
if a:0 && type(a:1) == type({})
let newObj._attributes = deepcopy(a:1)
endif
if exists('*BaseClassProcess')
let newObj._process = function('BaseClassProcess')
else
let newObj._process = function('s:_process_default')
endif
return newObj
endfu
"}}}
fu! g:BaseClass.setMember(name,val) dict "{{{
if !has_key(self, '_attributes')
echomsg "Creating attributes dict"
let self._attributes = {}
endif
let self._attributes[a:name] = a:val
" echomsg "BaseClass::setMember: Adding attribute named ".a:name." with following content:".string(a:val)
" echo a:val
endfu
"}}}
fu! g:BaseClass.getMember(name) dict "{{{
return get(get(self, '_attributes', {}), a:name)
" return get(get(self, '_attributes', {}), ''.string(a:name))
endfu
"}}}
fu! g:BaseClass.process() dict "{{{
call self._process()
endfu
"}}}
fu! s:_process_default() "{{{
echomsg 'nothing to see here, define BaseClassProcess() to make me interesting'
endfu
"}}}
"}}}
let g:jobsManager = copy(g:BaseClass)
Thanks for help
--
--
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.
Friday, September 2, 2016
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment