Add types to functions exported as API in src/pdf.js.
This commit is contained in:
parent
00a8b42e67
commit
bc4648c0a6
@ -446,7 +446,10 @@ function addLinkAttributes(link, { url, target, rel, enabled = true } = {}) {
|
|||||||
link.rel = typeof rel === "string" ? rel : DEFAULT_LINK_REL;
|
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) {
|
function getFilenameFromUrl(url) {
|
||||||
const anchor = url.indexOf("#");
|
const anchor = url.indexOf("#");
|
||||||
const query = url.indexOf("?");
|
const query = url.indexOf("?");
|
||||||
@ -520,6 +523,10 @@ function isValidFetchUrl(url, baseUrl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} src
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
function loadScript(src) {
|
function loadScript(src) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const script = document.createElement("script");
|
const script = document.createElement("script");
|
||||||
|
@ -467,6 +467,9 @@ class AbortException extends BaseException {}
|
|||||||
|
|
||||||
const NullCharactersRegExp = /\x00/g;
|
const NullCharactersRegExp = /\x00/g;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} str
|
||||||
|
*/
|
||||||
function removeNullCharacters(str) {
|
function removeNullCharacters(str) {
|
||||||
if (typeof str !== "string") {
|
if (typeof str !== "string") {
|
||||||
warn("The argument for removeNullCharacters must be a string.");
|
warn("The argument for removeNullCharacters must be a string.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user