Sha256: d11349278038b7b13667f49a64fdd55dd369990428c913cbe7bdad90bb3610d6

Contents?: true

Size: 1018 Bytes

Versions: 37

Compression:

Stored size: 1018 Bytes

Contents

goog.provide('webfont.StyleSheetWaiter');

/**
 * A utility class for handling callback from DomHelper.loadStylesheet().
 *
 * @constructor
 */
webfont.StyleSheetWaiter = function() {
  /** @private @type {number} */
  this.waitingCount_ = 0;
  /** @private @type {Function} */
  this.onReady_ = null;
};

goog.scope(function () {
  var StyleSheetWaiter = webfont.StyleSheetWaiter;

  /**
   * @return {function(Error)}
   */
  StyleSheetWaiter.prototype.startWaitingLoad = function() {
    var self = this;
    self.waitingCount_++;
    return function(error) {
      self.waitingCount_--;
      self.fireIfReady_();
    };
  };

  /**
   * @param {Function} fn
   */
  StyleSheetWaiter.prototype.waitWhileNeededThen = function(fn) {
    this.onReady_ = fn;
    this.fireIfReady_();
  };

  /**
   * @private
   */
  StyleSheetWaiter.prototype.fireIfReady_ = function() {
    var isReady = 0 == this.waitingCount_;
    if (isReady && this.onReady_) {
      this.onReady_();
      this.onReady_ = null;
    }
  };
});

Version data entries

37 entries across 37 versions & 3 rubygems

Version Path
jekyll-theme-hydejack-7.5.2 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-7.5.1 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-7.5.0 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-7.4.2 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-7.4.1 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-7.4.0 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-7.3.0 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-7.2.0 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-7.1.1 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-7.1.0 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-7.0.1 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-7.0.0 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-7.0.0.pre.beta.1 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-7.0.0.pre.beta.0 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-6.6.1 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-hydejack-6.6.0 assets/bower_components/webfontloader/src/core/stylesheetwaiter.js
jekyll-theme-chalk-0.1.1 _assets/yarn/webfontloader/src/core/stylesheetwaiter.js
webfontloader-1.6.28 src/core/stylesheetwaiter.js
webfontloader-1.6.27 src/core/stylesheetwaiter.js
webfontloader-1.6.26 src/core/stylesheetwaiter.js