docs: function(loaders, w, h, stage_elem) {
          // first argument is optional
          if (typeof loaders !== "object") {
              stage_elem = h;
              h = w;
              w = loaders;
              loaders = [];
          }
  
          var promises = [];
          for (var i in loaders) {
              if (typeof loaders[i] === "function") {
                  promises.push(loaders[i](Crafty));
              } else {
                  promises.push(loaders[i]);
              }
          }
  
          // wait for document loading if necessary
          if (document.readyState !== "complete") {
              var window_load = new Promise(function(resolve, reject) {
                  window.onload = resolve;
                  promises.push(window_load);
              });
          }
  
          return Promise.all(promises).then(function(values) {
              Crafty.init(w, h, stage_elem);
              // Return results only for promises passed in with the loaders array
              return values.slice(0, loaders.length);
          });
      }