From e25ab36ba8675322cefbcd5a174b0388ea957381 Mon Sep 17 00:00:00 2001 From: DD <liudi08@gmail.com> Date: Mon, 15 Oct 2018 11:12:16 -0400 Subject: [PATCH] Add comments --- src/containers/gui.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/containers/gui.jsx b/src/containers/gui.jsx index e4748805c..2c4c55be2 100644 --- a/src/containers/gui.jsx +++ b/src/containers/gui.jsx @@ -50,6 +50,9 @@ class GUI extends React.Component { const getFontPromises = () => { const fontPromises = []; + // Browsers that support the font loader interface have an iterable document.fonts.values() + // Firefox has a mocked out object that doesn't actually implement iterable, which is why + // the deep safety check is necessary. if (document.fonts && typeof document.fonts.values === 'function' && typeof document.fonts.values()[Symbol.iterator] === 'function') { @@ -61,6 +64,8 @@ class GUI extends React.Component { return fontPromises; }; + // Font promises must be gathered after the document is loaded, because on Mac Chrome, the promise + // objects get replaced and the old ones never resolve. if (document.readyState === 'complete') { Promise.all(getFontPromises()).then(this.loadProject); } else { -- GitLab