Skip to content

Commit 67c5410

Browse files
committed
Update lifecycle.js
1 parent cfbcd81 commit 67c5410

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/core/init/lifecycle.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,26 @@ export function Lifecycle(Base) {
3636
if (index >= queue.length) {
3737
next(data);
3838
} else if (typeof hookFn === 'function') {
39-
const errTitle = `Docsify plugin ${
40-
hookFn.name ? '"' + hookFn.name + '"' : ''
41-
} error (${hookName})`;
39+
const errTitle = `Docsify plugin error (${hookName})`;
4240

4341
if (hookFn.length === 2) {
4442
try {
4543
hookFn(data, result => {
4644
data = result;
45+
step(index + 1);
4746
});
4847
} catch (err) {
4948
console.error(errTitle, err);
5049
}
51-
step(index + 1);
5250
} else {
53-
let result;
54-
5551
try {
56-
result = hookFn(data);
52+
const result = hookFn(data);
53+
54+
data = result === undefined ? data : data;
5755
} catch (err) {
5856
console.error(errTitle, err);
5957
}
6058

61-
data = result || data;
6259
step(index + 1);
6360
}
6461
} else {

0 commit comments

Comments
 (0)