feat: add link of `parseResourceAddress` to `lib.init.promises`.

This commit is contained in:
Rintim 2024-05-11 15:25:51 +08:00
parent 26ef5daeca
commit 0e0cf646bc
No known key found for this signature in database
GPG Key ID: BE9E1EA615BACFCF
1 changed files with 11 additions and 0 deletions

View File

@ -63,4 +63,15 @@ export class LibInitPromises {
style.addEventListener("error", reject);
});
}
/**
* @async
* @param {string | URL} link - 需要解析的路径
* @param {(item: string) => string} [defaultHandle] - 在给定路径不符合可用情况或基于无名杀相关默认情况处理路径的函数返回的路径应是相对于根目录的相对路径默认为恒等函数
* @param {boolean} [forceLoadAsDataUrl] - 是否将资源加载为[Data URL](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Basics_of_HTTP/Data_URLs),默认为`false`
* @returns {Promise<URL>}
*/
parseResourceAddress(link, defaultHandle = item => item, forceLoadAsDataUrl = false) {
return lib.init.parseResourceAddress(link, defaultHandle, forceLoadAsDataUrl);
}
}