function get (url, hasBar) {
  if ( hasBar === void 0 ) hasBar = false;

  var xhr = new XMLHttpRequest();
  var on = function () {
    xhr.addEventListener.apply(xhr, arguments);
  };
  var cached$$1 = cache[url];

  if (cached$$1) {
    return { then: function (cb) { return cb(cached$$1.content, cached$$1.opt); }, abort: noop }
  }

  xhr.open('GET', url);
  xhr.send();

  return {
    then: function (success, error) {
      if ( error === void 0 ) error = noop;

      if (hasBar) {
        var id = setInterval(function (_) { return progressbar({
          step: Math.floor(Math.random() * 5 + 1)
        }); }, 500);

        on('progress', progressbar);
        on('loadend', function (evt) {
          progressbar(evt);
          clearInterval(id);
        });
      }

      on('error', error);
      on('load', function (ref) {
        var target = ref.target;

        if (target.status >= 400) {
          error(target);
        } else {
          var result = cache[url] = {
            content: target.response,
            opt: {
              updatedAt: xhr.getResponseHeader('last-modified')
            }
          };

          success(result.content, result.opt);
        }
      });
    },
    abort: function (_) { return xhr.readyState !== 4 && xhr.abort(); }
  }
}
Simple ajax get
@param {string} url
@param {boolean} [hasBar=false] has progress bar
@return { then(resolve, reject), abort }