mirror of
https://gitee.com/docsifyjs/docsify.git
synced 2024-12-03 12:39:41 +08:00
Fix eslint warnings (#1388)
This commit is contained in:
parent
761210c2cf
commit
0afbf96701
@ -73,7 +73,7 @@ export function fetchMixin(proto) {
|
||||
case 'object':
|
||||
key = Object.keys(notFoundPage)
|
||||
.sort((a, b) => b.length - a.length)
|
||||
.find(key => path.match(new RegExp('^' + key)));
|
||||
.find(k => path.match(new RegExp('^' + k)));
|
||||
|
||||
path404 = (key && notFoundPage[key]) || defaultPath;
|
||||
break;
|
||||
|
@ -18,21 +18,22 @@ export function initLifecycle(vm) {
|
||||
});
|
||||
}
|
||||
|
||||
export function callHook(vm, hook, data, next = noop) {
|
||||
const queue = vm._hooks[hook];
|
||||
export function callHook(vm, hookName, data, next = noop) {
|
||||
const queue = vm._hooks[hookName];
|
||||
|
||||
const step = function(index) {
|
||||
const hook = queue[index];
|
||||
const hookFn = queue[index];
|
||||
|
||||
if (index >= queue.length) {
|
||||
next(data);
|
||||
} else if (typeof hook === 'function') {
|
||||
if (hook.length === 2) {
|
||||
hook(data, result => {
|
||||
} else if (typeof hookFn === 'function') {
|
||||
if (hookFn.length === 2) {
|
||||
hookFn(data, result => {
|
||||
data = result;
|
||||
step(index + 1);
|
||||
});
|
||||
} else {
|
||||
const result = hook(data);
|
||||
const result = hookFn(data);
|
||||
data = result === undefined ? data : result;
|
||||
step(index + 1);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ function walkFetchEmbed({ embedTokens, compile, fetch }, cb) {
|
||||
}
|
||||
|
||||
while ((token = embedTokens[step++])) {
|
||||
// eslint-disable-next-line no-shadow
|
||||
const next = (function(token) {
|
||||
return text => {
|
||||
let embedToken;
|
||||
|
@ -190,7 +190,9 @@ export function renderMixin(proto) {
|
||||
html = formatUpdated(html, opt.updatedAt, this.config.formatUpdated);
|
||||
}
|
||||
|
||||
callHook(this, 'afterEach', html, text => renderMain.call(this, text));
|
||||
callHook(this, 'afterEach', html, hookData =>
|
||||
renderMain.call(this, hookData)
|
||||
);
|
||||
};
|
||||
|
||||
if (this.isHTML) {
|
||||
|
Loading…
Reference in New Issue
Block a user