<commit_before><link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../promise-polyfill/promise-polyfill-lite.html">

<script>
  'use strict';

  var WebEnzymes = WebEnzymes || {};

  WebEnzymes.ImportBehavior = {

    _extractImports: function(node) {
      var nodes = node.querySelectorAll('link[rel=import]');
      var imports = [];
      for (var i = 0; i < nodes.length; i++) {
        var el = nodes[i];
        if (this.elementMatches(Polymer.StyleUtil.MODULE_STYLES_SELECTOR, el)) {
          continue;
        }
        imports.push({
          href: el.href || el.getAttribute('href'),
          async: el.hasAttribute('async')
        });
        if (el.parentNode) {
          el.parentNode.removeChild(el);
        }
      }
      return imports;
    },

    _bulkImporter: function(imports) {
      var promises = [];
      for (var i = 0; i < imports.length; i++) {
        var imp = imports[i];
        promises.push(new Promise(function(resolve, reject) {
          Polymer.Base.importHref(imp.href, resolve, reject, imp.async);
        }));
      }
      return Promise.all(promises);
    }

  };
</script><commit_msg>Update: Avoid promises (fixes #2)<commit_after><link rel="import" href="../polymer/polymer.html">

<script>
  'use strict';

  var WebEnzymes = WebEnzymes || {};

  WebEnzymes.ImportBehavior = {

    _extractImports: function(node) {
      var nodes = node.querySelectorAll('link[rel=import]');
      var imports = [];
      for (var i = 0; i < nodes.length; i++) {
        var el = nodes[i];
        if (this.elementMatches(Polymer.StyleUtil.MODULE_STYLES_SELECTOR, el)) {
          continue;
        }
        imports.push({
          href: el.href || el.getAttribute('href'),
          async: el.hasAttribute('async')
        });
        if (el.parentNode) {
          el.parentNode.removeChild(el);
        }
      }
      return imports;
    },

    _bulkImporter: function(imports, resolve, onerror) {

      var onload;
      if (typeof resolve === 'function') {
        if (imports.length < 1) {
          resolve();
          return;
        }

        onload = (function(count) {
          return function() {
            count--;
            if (count === 0) {
              resolve();
            }
          }
        })(imports.length);
      }

      for (var i = 0; i < imports.length; i++) {
        var imp = imports[i];
        Polymer.Base.importHref(imp.href, onload, onerror, imp.async);
      }
    }

  };
</script>
{'fraction_non_alphanumeric': 0.1508, 'fraction_numerical': 0.0028, 'mean_word_length': 2.0060096153846154, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 10, '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': '2444287', 'n_tokens_mistral': 790, 'n_tokens_neox': 769, 'n_words': 154}