mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-14 20:14:39 +00:00
10 lines
353 B
TypeScript
10 lines
353 B
TypeScript
import { select_route, prefetching, set_prefetching, prepare_page } from '../app';
|
|
import { Target } from '../types';
|
|
|
|
export default function prefetch(href: string) {
|
|
const target: Target = select_route(new URL(href, document.baseURI));
|
|
|
|
if (target && (!prefetching || href !== prefetching.href)) {
|
|
set_prefetching(href, prepare_page(target));
|
|
}
|
|
} |