<commit_before>var assets = {
    mapTiles: {
        type: "atlas",
        configuration: "./art/panama.json",
        file: "./art/panama.png"
    }
};

var AssetLoaderConstructor = function () {
    this.queue = 0;
};

AssetLoaderConstructor.prototype.preloadAssets = function () {
    var that = this;
    // loop through the asset object and load each asset file
    _.forEach(assets, function (asset) {
        that.queue++;
        switch (asset.type) {
            case 'atlas':
                that.loadAtlas(asset);
                break;

            case 'music':
                break;
        }
    });
};

AssetLoaderConstructor.prototype.preloadComplete = function () {
    return this.queue > 0 ? false : true;
};
AssetLoaderConstructor.prototype.loadAtlas = function (data) {
    var confRequest = jQuery.getJSON(data.configuration);

};

var assetLoader = new AssetLoaderConstructor();<commit_msg>add asynch atlas sprite loader<commit_after>var assets = {
  config: {
    mapTiles: {
      type: "atlas",
      configuration: "./art/panama.json",
      file: "./art/panama.png"
    }
  },
  loaded : {
    atlas : [],
    music : []
  }
};

var AssetLoaderConstructor = function () {
  this.queue = 0;
};

AssetLoaderConstructor.prototype.preloadAssets = function () {
  var that = this;
  // loop through the asset object and load each asset file
  _.forEach(assets.config, function (asset) {
    that.queue++;
    switch (asset.type) {
      case 'atlas':
        that.loadAtlas(asset, function (loadedAsset) {
          assets.loaded.atlas.push(loadedAsset);
          that.queue--;
        });
        break;

      case 'music':
        break;
    }
  });
};

AssetLoaderConstructor.prototype.preloadComplete = function () {
  return this.queue > 0 ? false : true;
};
AssetLoaderConstructor.prototype.loadAtlas = function (asset, callback) {

  jQuery.getJSON(asset.configuration,function (data) {
    asset.configuration = data;
  }).then(function () {
      var img = new Image();
      img.src = asset.file;
      asset.file = img;
      callback(asset)
    }
  );
};

var assetLoader = new AssetLoaderConstructor();
{'fraction_non_alphanumeric': 0.13059701492537312, 'fraction_numerical': 0.0018656716417910447, 'mean_word_length': 2.4596774193548385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1852782', 'n_tokens_mistral': 645, 'n_tokens_neox': 627, 'n_words': 141}