mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Chore: minor changes
This commit is contained in:
@@ -56,7 +56,6 @@ export async function* createReadlineInterfaceFromResponse(resp: Response): Asyn
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchRemoteTextAndCreateReadlineInterface(url: string | URL, opt?: RequestInit): Promise<AsyncGenerator<string>> {
|
||||
const resp = await fetchWithRetry(url, opt);
|
||||
return createReadlineInterfaceFromResponse(resp);
|
||||
export function fetchRemoteTextAndCreateReadlineInterface(url: string | URL, opt?: RequestInit): Promise<AsyncGenerator<string>> {
|
||||
return fetchWithRetry(url, opt).then(res => createReadlineInterfaceFromResponse(res));
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ export async function processDomainLists(domainListsUrl: string | URL) {
|
||||
}
|
||||
|
||||
export async function processHosts(hostsUrl: string | URL, includeAllSubDomain = false) {
|
||||
console.time(` - processHosts: ${hostsUrl}`);
|
||||
console.time(`- processHosts: ${hostsUrl}`);
|
||||
|
||||
if (typeof hostsUrl === 'string') {
|
||||
hostsUrl = new URL(hostsUrl);
|
||||
|
||||
@@ -18,6 +18,12 @@ const traceAsync = async <T>(prefix: string, fn: () => Promise<T>): Promise<T> =
|
||||
};
|
||||
export { traceAsync };
|
||||
|
||||
export interface TaskResult {
|
||||
readonly start: number;
|
||||
readonly end: number;
|
||||
readonly taskName: string;
|
||||
}
|
||||
|
||||
const task = <T>(__filename: string, fn: () => Promise<T>, customname: string | null = null) => {
|
||||
const taskName = customname ?? path.basename(__filename, path.extname(__filename));
|
||||
return async () => {
|
||||
@@ -27,7 +33,7 @@ const task = <T>(__filename: string, fn: () => Promise<T>, customname: string |
|
||||
const end = performance.now();
|
||||
console.log(`✅ [${taskName}] Executed successfully: ${(end - start).toFixed(3)}ms`);
|
||||
|
||||
return { start, end, taskName } as const;
|
||||
return { start, end, taskName } as TaskResult;
|
||||
};
|
||||
};
|
||||
export { task };
|
||||
|
||||
Reference in New Issue
Block a user