MCPcopy Index your code
hub / github.com/docsifyjs/docsify / initLifecycle

Method initLifecycle

src/core/init/lifecycle.js:11–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9export function Lifecycle(Base) {
10 return class Lifecycle extends Base {
11 initLifecycle() {
12 const hooks = [
13 'init',
14 'mounted',
15 'beforeEach',
16 'afterEach',
17 'doneEach',
18 'ready',
19 ];
20
21 this._hooks = {};
22 this._lifecycle = {};
23
24 hooks.forEach(hook => {
25 const arr = (this._hooks[hook] = []);
26 this._lifecycle[hook] = fn => arr.push(fn);
27 });
28 }
29
30 callHook(hookName, data, next = noop) {
31 const queue = this._hooks[hookName];

Callers 1

constructorMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected