Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur791004 committed Mar 1, 2024
1 parent b77d34d commit 581d9ee
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ export async function loadFontFaceInBrowser( fontFace, source, addTo = 'all' ) {
*
* Note that Font faces that were added to the set using the CSS @font-face rule
* remain connected to the corresponding CSS, and cannot be deleted.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/delete.
*/
export function unloadFontFaceInBrowser( fontFace, addTo = 'all' ) {
export function unloadFontFaceInBrowser( fontFace, removeFrom = 'all' ) {
const unloadFontFace = ( fonts ) => {
fonts.forEach( ( f ) => {
if (
Expand All @@ -141,11 +143,11 @@ export function unloadFontFaceInBrowser( fontFace, addTo = 'all' ) {
} );
};

if ( addTo === 'document' || addTo === 'all' ) {
if ( removeFrom === 'document' || removeFrom === 'all' ) {
unloadFontFace( document.fonts );
}

if ( addTo === 'iframe' || addTo === 'all' ) {
if ( removeFrom === 'iframe' || removeFrom === 'all' ) {
const iframeDocument = document.querySelector(
'iframe[name="editor-canvas"]'
).contentDocument;
Expand Down

0 comments on commit 581d9ee

Please sign in to comment.