summaryrefslogtreecommitdiff
path: root/.vim/pack/vendor/start/nerdtree/lib/nerdtree/notifier.vim
diff options
context:
space:
mode:
Diffstat (limited to '.vim/pack/vendor/start/nerdtree/lib/nerdtree/notifier.vim')
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/notifier.vim35
1 files changed, 35 insertions, 0 deletions
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/notifier.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/notifier.vim
new file mode 100644
index 0000000..ffa2853
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/notifier.vim
@@ -0,0 +1,35 @@
1"CLASS: Notifier
2"============================================================
3let s:Notifier = {}
4
5function! s:Notifier.AddListener(event, funcname)
6 let listeners = s:Notifier.GetListenersForEvent(a:event)
7 if listeners == []
8 let listenersMap = s:Notifier.GetListenersMap()
9 let listenersMap[a:event] = listeners
10 endif
11 call add(listeners, a:funcname)
12endfunction
13
14function! s:Notifier.NotifyListeners(event, path, nerdtree, params)
15 let event = g:NERDTreeEvent.New(a:nerdtree, a:path, a:event, a:params)
16
17 for Listener in s:Notifier.GetListenersForEvent(a:event)
18 let l:Callback = type(Listener) == type(function('tr')) ? Listener : function(Listener)
19 call l:Callback(event)
20 endfor
21endfunction
22
23function! s:Notifier.GetListenersMap()
24 if !exists('s:refreshListenersMap')
25 let s:refreshListenersMap = {}
26 endif
27 return s:refreshListenersMap
28endfunction
29
30function! s:Notifier.GetListenersForEvent(name)
31 let listenersMap = s:Notifier.GetListenersMap()
32 return get(listenersMap, a:name, [])
33endfunction
34
35let g:NERDTreePathNotifier = deepcopy(s:Notifier)