mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Perf: run cpu intensive task with worker
This commit is contained in:
@@ -30,5 +30,9 @@ const getGorhillPublicSuffix = async () => {
|
||||
return gorhill;
|
||||
};
|
||||
|
||||
const getGorhillPublicSuffixPromise = getGorhillPublicSuffix();
|
||||
module.exports.getGorhillPublicSuffixPromise = getGorhillPublicSuffixPromise;
|
||||
/** @type {Promise<import('gorhill-publicsuffixlist').default | null>} */
|
||||
let gorhillPublicSuffixPromise = null;
|
||||
module.exports.getGorhillPublicSuffixPromise = () => {
|
||||
gorhillPublicSuffixPromise ||= getGorhillPublicSuffix();
|
||||
return gorhillPublicSuffixPromise;
|
||||
};
|
||||
|
||||
@@ -10,10 +10,10 @@ module.exports.isDomainLoose = (domain) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} domain
|
||||
* @param {string | null | undefined} domain
|
||||
*/
|
||||
module.exports.normalizeDomain = (domain) => {
|
||||
if (domain == null) {
|
||||
if (!domain) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user