We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents fd70d89 + c987fdf commit d25f793Copy full SHA for d25f793
src/core/nativefontwatchrunner.js
@@ -51,11 +51,16 @@ goog.scope(function () {
51
check();
52
});
53
54
- var timer = new Promise(function (resolve, reject) {
55
- setTimeout(reject, that.timeout_);
56
- });
+ var timeoutId = null,
+ timer = new Promise(function (resolve, reject) {
+ timeoutId = setTimeout(reject, that.timeout_);
57
+ });
58
59
Promise.race([timer, loader]).then(function () {
60
+ if (timeoutId) {
61
+ clearTimeout(timeoutId);
62
+ timeoutId = null;
63
+ }
64
that.activeCallback_(that.font_);
65
}, function () {
66
that.inactiveCallback_(that.font_);
0 commit comments