mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-26 00:34:19 +01:00
Add fetchWorker for fetching off the main thread
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { TTLCache, unfurl } from '@/deps.ts';
|
||||
import { Time } from '@/utils/time.ts';
|
||||
import { fetchWorker } from '@/workers/fetch.ts';
|
||||
|
||||
interface PreviewCard {
|
||||
url: string;
|
||||
@@ -22,7 +23,7 @@ async function unfurlCard(url: string, signal: AbortSignal): Promise<PreviewCard
|
||||
console.log(`Unfurling ${url}...`);
|
||||
try {
|
||||
const result = await unfurl(url, {
|
||||
fetch: (url) => fetch(url, { signal }),
|
||||
fetch: (url) => fetchWorker(url, { signal }),
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user