Merge pull request #11673 from Snuffleupagus/FontLoader-bind-more-await
Update the `FontLoader.bind` method to avoid explicitly returning `undefined`
This commit is contained in:
commit
1bb25f5cb8
@ -71,7 +71,7 @@ class BaseFontLoader {
|
|||||||
async bind(font) {
|
async bind(font) {
|
||||||
// Add the font to the DOM only once; skip if the font is already loaded.
|
// Add the font to the DOM only once; skip if the font is already loaded.
|
||||||
if (font.attached || font.missingFile) {
|
if (font.attached || font.missingFile) {
|
||||||
return undefined;
|
return;
|
||||||
}
|
}
|
||||||
font.attached = true;
|
font.attached = true;
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ class BaseFontLoader {
|
|||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return undefined; // The font was, asynchronously, loaded.
|
return; // The font was, asynchronously, loaded.
|
||||||
}
|
}
|
||||||
|
|
||||||
// !this.isFontLoadingAPISupported
|
// !this.isFontLoadingAPISupported
|
||||||
@ -99,14 +99,14 @@ class BaseFontLoader {
|
|||||||
this.insertRule(rule);
|
this.insertRule(rule);
|
||||||
|
|
||||||
if (this.isSyncFontLoadingSupported) {
|
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);
|
const request = this._queueLoadingCallback(resolve);
|
||||||
this._prepareFontLoadEvent([rule], [font], request);
|
this._prepareFontLoadEvent([rule], [font], request);
|
||||||
});
|
});
|
||||||
|
// The font was, asynchronously, loaded.
|
||||||
}
|
}
|
||||||
return undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_queueLoadingCallback(callback) {
|
_queueLoadingCallback(callback) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user