mirror of
https://github.com/SukkaW/Surge.git
synced 2026-02-03 04:21:53 +08:00
Minor changes here and there
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
import { createCache } from './cache-apply';
|
||||
import type { PublicSuffixList } from '@gorhill/publicsuffixlist';
|
||||
|
||||
let gothillGetDomainCache: ReturnType<typeof createCache> | null = null;
|
||||
let gorhillGetDomainCache: ReturnType<typeof createCache> | null = null;
|
||||
export const createCachedGorhillGetDomain = (gorhill: PublicSuffixList) => {
|
||||
gothillGetDomainCache ??= createCache('cached-gorhill-get-domain', true);
|
||||
return (domain: string) => {
|
||||
// we do know gothillGetDomainCache exists here
|
||||
return gothillGetDomainCache!.sync(domain, () => gorhill.getDomain(domain[0] === '.' ? domain.slice(1) : domain));
|
||||
};
|
||||
gorhillGetDomainCache ??= createCache('cached-gorhill-get-domain', true);
|
||||
return (domain: string) => gorhillGetDomainCache! // we do know gothillGetDomainCache exists here
|
||||
.sync(domain, () => gorhill.getDomain(domain[0] === '.' ? domain.slice(1) : domain));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user