Skip to content

Add 'global' helper to register events globally#42

Open
lambdalisue wants to merge 1 commit intothinca:masterfrom
lambdalisue:add-helper-global
Open

Add 'global' helper to register events globally#42
lambdalisue wants to merge 1 commit intothinca:masterfrom
lambdalisue:add-helper-global

Conversation

@lambdalisue
Copy link
Copy Markdown
Contributor

To solve #26. I create a 'global' helper which can register events globally like:

let s:events = {}

function! s:events.initialize() abort
  call themis#log('Initialize')
endfunction

function! s:events.before() abort
  call themis#log('Before')
endfunction

function! s:events.before_each() abort
  call themis#log('Before each')
endfunction

function! s:events.after_each() abort
  call themis#log('After each')
endfunction

function! s:events.after() abort
  call themis#log('After')
endfunction

function! s:events.finalize() abort
  call themis#log('Finalize')
endfunction

" Register global event
call themis#helper('global').with(s:events)

@thinca
Copy link
Copy Markdown
Owner

thinca commented Aug 25, 2016

すいませんがちょっと保留させてください。インターフェースがちょっとしっくり来ない…(主に with)。

@lambdalisue
Copy link
Copy Markdown
Contributor Author

Oh. 了解しました。

@lambdalisue
Copy link
Copy Markdown
Contributor Author

ping

@lambdalisue
Copy link
Copy Markdown
Contributor Author

これ

call themis#helper('global').use(s:events)

とかだとシックリきたりします?w

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants