Skip to content

Commit 18bea81

Browse files
committed
feat(index.mjs): add support for rIC timeout customisation
1 parent 43306cf commit 18bea81

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/index.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const prefetchURLs = function (urls, priority) {
7070
*/
7171
export default function (options) {
7272
return new Promise((resolve, reject) => {
73-
options = options || {priority: 'low'};
73+
options = options || {priority: 'low', timeout: 2000};
7474
requestIdleCallback(() => {
7575
// Prefetch an array of URLs if supplied (as an override)
7676
if (options.urls !== undefined && options.urls.length > 0) {
@@ -84,6 +84,6 @@ export default function (options) {
8484
resolve(urls);
8585
});
8686
}
87-
});
87+
}, {timeout: options.timeout});
8888
});
8989
}

0 commit comments

Comments
 (0)