feat(hook): add doneEach
This commit is contained in:
parent
558d73c2a8
commit
c6f760275c
6 changed files with 30 additions and 5 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ const Docsify = function () {
|
|||
mainRender(_ => {
|
||||
scrollIntoView()
|
||||
activeLink('nav')
|
||||
window.Docsify.hook.emit('doneEach')
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ const install = function () {
|
|||
new SearchComponent()
|
||||
!isAuto && searchPlugin()
|
||||
})
|
||||
isAuto && hook.beforeEach(searchPlugin)
|
||||
isAuto && hook.doneEach(searchPlugin)
|
||||
}, window.$docsify.plugins)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue