Skip to content

feat: The timing of the doneEach hook call for the cover #2427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: The timing of the doneEach hook call for the cover
The `doneEach` hook function for the cover should be called after the cover page HTML has been appended to the DOM.
  • Loading branch information
YiiGuxing committed May 13, 2024
commit bd5f879cb859c024169ba621683c184fe1c20be2
30 changes: 17 additions & 13 deletions src/core/fetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export function Fetch(Base) {
}
}

_fetchCover() {
_fetchCover(cb = noop) {
const { coverpage, requestHeaders } = this.config;
const query = this.route.query;
const root = getParentPath(this.route.path);
Expand All @@ -174,13 +174,17 @@ export function Fetch(Base) {
path = this.router.getFile(root + path);
this.coverIsHTML = /\.html$/g.test(path);
get(path + stringifyQuery(query, ['id']), false, requestHeaders).then(
text => this._renderCover(text, coverOnly)
text => {
this._renderCover(text, coverOnly);
cb(coverOnly);
}
);
} else {
this._renderCover(null, coverOnly);
cb(coverOnly);
}

return coverOnly;
} else {
cb(false);
}
}

Expand All @@ -190,16 +194,16 @@ export function Fetch(Base) {
cb();
};

const onlyCover = this._fetchCover();

if (onlyCover) {
done();
} else {
this._fetch(() => {
onNavigate();
this._fetchCover(onlyCover => {
if (onlyCover) {
done();
});
}
} else {
this._fetch(() => {
onNavigate();
done();
});
}
});
}

_fetchFallbackPage(path, qs, cb = noop) {
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy