{"size": 1194, "ext": "js", "max_stars_repo_path": "static/js/keiken/map/preloadMarkerIconImages.js", "max_stars_repo_name": "fvclaus/photomap", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "static/js/keiken/map/preloadMarkerIconImages.js", "max_issues_repo_name": "fvclaus/photomap", "max_issues_repo_issues_event_min_datetime": "2019-12-11T17:21:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T06:09:41.000Z", "max_forks_repo_path": "static/js/keiken/map/preloadMarkerIconImages.js", "max_forks_repo_name": "fvclaus/photomap", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 10, "max_forks_count": null, "avg_line_length": 28.4285714286, "max_line_length": 77, "alphanum_fraction": 0.5845896147}
define(["dojo/domReady!"], function () {
  return {
    // eslint-disable-next-line no-unused-vars
    load: function (id, require, callback) {
      var imageUrlDefinitions = [{
        modelName: "Album",
        url: "/static/images/marker-icons/album.png"
      }, {
        modelName: "Place",
        url: "/static/images/marker-icons/place.png"
      }]

      var areAllImagesLoaded = function () {
        return imageUrlDefinitions.reduce(function (loadStatus, definition) {
          return loadStatus && definition.isLoaded
        }, true)
      }

      var definitionsToMap = function (imageUrlDefinitions) {
        return imageUrlDefinitions.reduce(function (map, definition) {
          map[definition.modelName] = definition.img
          return map
        }, {})
      }

      imageUrlDefinitions.forEach(function (definition) {
        definition.isLoaded = false
        var img = new Image()
        img.onload = function () {
          definition.isLoaded = true

          if (areAllImagesLoaded()) {
            callback(definitionsToMap(imageUrlDefinitions))
          }
        }
        img.src = definition.url
        definition.img = img
      })
    }
  }
})
