Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the FontLoader.bind method to avoid explicitly returning undefined #11673

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/display/font_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class BaseFontLoader {
async bind(font) {
// Add the font to the DOM only once; skip if the font is already loaded.
if (font.attached || font.missingFile) {
return undefined;
return;
}
font.attached = true;

Expand All @@ -90,7 +90,7 @@ class BaseFontLoader {
throw ex;
}
}
return undefined; // The font was, asynchronously, loaded.
return; // The font was, asynchronously, loaded.
}

// !this.isFontLoadingAPISupported
Expand All @@ -99,14 +99,14 @@ class BaseFontLoader {
this.insertRule(rule);

if (this.isSyncFontLoadingSupported) {
return undefined; // The font was, synchronously, loaded.
return; // The font was, synchronously, loaded.
}
return new Promise(resolve => {
await new Promise(resolve => {
const request = this._queueLoadingCallback(resolve);
this._prepareFontLoadEvent([rule], [font], request);
});
// The font was, asynchronously, loaded.
}
return undefined;
}

_queueLoadingCallback(callback) {
Expand Down