Files
freeCodeCamp/client/utils/gatsby/page-loading.ts
Huyen Nguyen 29607fb473 feat(client): prefetch next challenge (#55472)
Co-authored-by: ahmad abdolsaheb <ahmad.abdolsaheb@gmail.com>
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2024-07-19 11:12:07 +03:00

11 lines
350 B
TypeScript

/**
* 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);
};