feat(hook): add doneEach

This commit is contained in:
qingwei.li 2017-02-13 23:06:30 +08:00
commit c6f760275c
6 changed files with 30 additions and 5 deletions

View file

@ -4,6 +4,7 @@ export default class Hook {
this.afterHooks = []
this.initHooks = []
this.readyHooks = []
this.doneEachHooks = []
}
beforeEach (fn) {
@ -14,6 +15,10 @@ export default class Hook {
this.afterHooks.push(fn)
}
doneEach (fn) {
this.doneEachHooks.push(fn)
}
init (fn) {
this.initHooks.push(fn)
}

View file

@ -130,6 +130,7 @@ const Docsify = function () {
mainRender(_ => {
scrollIntoView()
activeLink('nav')
window.Docsify.hook.emit('doneEach')
})
}

View file

@ -342,7 +342,7 @@ const install = function () {
new SearchComponent()
!isAuto && searchPlugin()
})
isAuto && hook.beforeEach(searchPlugin)
isAuto && hook.doneEach(searchPlugin)
}, window.$docsify.plugins)
}