Skip to content

Commit

Permalink
Add types to functions exported as API in src/pdf.js.
Browse files Browse the repository at this point in the history
  • Loading branch information
tamuratak committed Aug 3, 2020
1 parent 00a8b42 commit bc4648c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/display/display_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,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("?");
Expand Down Expand Up @@ -520,6 +523,10 @@ function isValidFetchUrl(url, baseUrl) {
}
}

/**
* @param {string} src
* @returns {Promise<void>}
*/
function loadScript(src) {
return new Promise((resolve, reject) => {
const script = document.createElement("script");
Expand Down
3 changes: 3 additions & 0 deletions src/shared/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down

0 comments on commit bc4648c

Please sign in to comment.