<commit_before>goog.provide('webfont.NativeFontWatchRunner');

goog.require('webfont.Font');

goog.scope(function () {
  /**
  * @constructor
  * @param {function(webfont.Font)} activeCallback
  * @param {function(webfont.Font)} inactiveCallback
  * @param {webfont.DomHelper} domHelper
  * @param {webfont.Font} font
  * @param {string=} opt_fontTestString
  */
  webfont.NativeFontWatchRunner = function(activeCallback, inactiveCallback, domHelper, font, opt_fontTestString) {
    this.activeCallback_ = activeCallback;
    this.inactiveCallback_ = inactiveCallback;
    this.font_ = font;
    this.domHelper_ = domHelper;
    this.fontTestString_ = opt_fontTestString || null;
  };

  var NativeFontWatchRunner = webfont.NativeFontWatchRunner;

  NativeFontWatchRunner.prototype.start = function () {
    var doc = this.domHelper_.getLoadWindow();

    if (doc['fonts']['check'](this.font_.toCssString(), this.fontTestString_)) {
      this.activeCallback_(this.font_);
    } else {
      doc['fonts']['load'](this.font_.toCssString(), this.fontTestString_).then(
        goog.bind(this.activeCallback_, this, this.font_),
        goog.bind(this.inactiveCallback_, this, this.font_));
    }
  };
});
<commit_msg>Prevent closure compiler from complaining about a new API returning a Promise.<commit_after>goog.provide('webfont.NativeFontWatchRunner');

goog.require('webfont.Font');

goog.scope(function () {
  /**
  * @constructor
  * @param {function(webfont.Font)} activeCallback
  * @param {function(webfont.Font)} inactiveCallback
  * @param {webfont.DomHelper} domHelper
  * @param {webfont.Font} font
  * @param {string=} opt_fontTestString
  */
  webfont.NativeFontWatchRunner = function(activeCallback, inactiveCallback, domHelper, font, opt_fontTestString) {
    this.activeCallback_ = activeCallback;
    this.inactiveCallback_ = inactiveCallback;
    this.font_ = font;
    this.domHelper_ = domHelper;
    this.fontTestString_ = opt_fontTestString || null;
  };

  var NativeFontWatchRunner = webfont.NativeFontWatchRunner;

  NativeFontWatchRunner.prototype.start = function () {
    var doc = this.domHelper_.getLoadWindow();

    if (doc['fonts']['check'](this.font_.toCssString(), this.fontTestString_)) {
      this.activeCallback_(this.font_);
    } else {
      doc['fonts']['load'](this.font_.toCssString(), this.fontTestString_)['then'](
        goog.bind(this.activeCallback_, this, this.font_),
        goog.bind(this.inactiveCallback_, this, this.font_));
    }
  };
});

{'fraction_non_alphanumeric': 0.13610888710968774, 'fraction_numerical': 0.0, 'mean_word_length': 4.553333333333334, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7466439', 'n_tokens_mistral': 804, 'n_tokens_neox': 779, 'n_words': 125}