Merge pull request #12161 from tamuratak/exported_func

Add types to functions exported as API in src/pdf.js (PR 12102 follow-up)
This commit is contained in:
Tim van der Meij 2020-08-03 22:43:50 +02:00 committed by GitHub
commit adc7645a44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -447,7 +447,10 @@ function addLinkAttributes(link, { url, target, rel, enabled = true } = {}) {
link.rel = typeof rel === "string" ? rel : DEFAULT_LINK_REL;
}
// Gets the file name from a given URL.
/**
* Gets the file name from a given URL.
* @param {string} url
*/
function getFilenameFromUrl(url) {
const anchor = url.indexOf("#");
const query = url.indexOf("?");
@ -521,6 +524,10 @@ function isValidFetchUrl(url, baseUrl) {
}
}
/**
* @param {string} src
* @returns {Promise<void>}
*/
function loadScript(src) {
return new Promise((resolve, reject) => {
const script = document.createElement("script");

View File

@ -467,6 +467,9 @@ class AbortException extends BaseException {}
const NullCharactersRegExp = /\x00/g;
/**
* @param {string} str
*/
function removeNullCharacters(str) {
if (typeof str !== "string") {
warn("The argument for removeNullCharacters must be a string.");