mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat(client): prefetch next challenge (#55472)
Co-authored-by: ahmad abdolsaheb <ahmad.abdolsaheb@gmail.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
declare global {
|
||||
interface Window {
|
||||
// This is a feature Gatsby adds to the `window` object.
|
||||
// https://github.com/gatsbyjs/gatsby/blob/deb41cdfefbefe0c170b5dd7c10a19ba2b338f6e/packages/gatsby/cache-dir/production-app.js#L28
|
||||
___loader: {
|
||||
hovering: (path: string | null) => void;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* The function is useful in cases where we want to preload a page
|
||||
* but the link of the page isn't rendered on the screen.
|
||||
* For more details, see https://github.com/freeCodeCamp/freeCodeCamp/pull/55472.
|
||||
*/
|
||||
export const preloadPage = (path: string | null) => {
|
||||
if (!window.___loader || !path) return;
|
||||
|
||||
window.___loader.hovering(path);
|
||||
};
|
||||
Reference in New Issue
Block a user