Function: loadResources

Loads all required resources asynchronously. Use this to load the graph and
editor resources if <mxLoadResources> is false.

Parameters:

callback - Callback function for asynchronous loading.
967024
function(callback)
	{
		mxResources.add(mxClient.basePath+'/resources/editor', null, function()
		{
			mxResources.add(mxClient.basePath+'/resources/graph', null, callback);
		});
	}
545868
public void loadNewElementInfo(final AsyncCallback<Void> callback) {

        CmsRpcAction<List<CmsNewResourceInfo>> newResourceInfoAction = new CmsRpcAction<List<CmsNewResourceInfo>>() {

            @Override
            public void execute() {

                start(200, true);

                getService().getNewElementInfo(m_data.getRoot().getSitePath(), this);
            }

            @Override
            protected void onResponse(List<CmsNewResourceInfo> result) {

                stop(false);

                m_data.setNewElementInfos(result);
                if (callback != null) {
                    callback.onSuccess(null);
                }
            }

        };
        newResourceInfoAction.execute();
    }
397563
function loaded(err)
  {
    if(err)
    {
      log.error(err);
      cbMesh(err);
      return false;
    }

    return telehash.mesh(args, function(err, mesh){
      if(!mesh) return cbMesh(err);

      // sync links automatically to file whenever they change
      if(linksFile) mesh.linked(function(json, str){
        log.debug('syncing links json',linksFile,str.length);
        fs.writeFileSync(linksFile, str);
      });

      cbMesh(err, mesh);
    });
  }
156217
function someAsyncFunction(file, callback) {
    // Here we just wrap the function body to make it synchronous inside
    // Sync will execute first argument 'fn' in synchronous way
    // and call second argument 'callback' when function returns
    // it also calls callback if exception will be thrown inside of 'fn'
    Sync(function(){
        var source = require('fs').readFile.sync(null, __filename);
        return source;
    }, callback)
}
926302
function loadResource(sUrl, sType) {
		return new Promise(function (resolve, reject) {
			jQuery.ajax({
				url: sUrl,
				async: true,
				dataType: sType,
				success: function (oJson) {
					resolve(oJson);
				},
				error: function () {
					reject();
				}
			});
		});
	}
1149134
function(callback) {
      var asyncFunctions = [];

      for (var i = 0; i < numberOfRows; i++) {
        var rowsImagesPaths = imagesPaths.slice(i * numberOfColumns, i * numberOfColumns + numberOfColumns);
        var lineWidth = width;
        var lineHeight = height;
        var linePath = path.join(temporaryDirectoryPath, 'line-' + i);

        linesPaths.push(linePath);
        asyncFunctions.push(createLine(rowsImagesPaths, linePath, lineWidth, lineHeight, true, 100));
      }

      async.parallel(asyncFunctions, function(error, results) {
        if (error) return callback(error);

        results.forEach(function(line) {
          line.forEach(function(image) {
            if (image.image === path.join(temporaryDirectoryPath, 'transparent.png')) return;

            var spritePathChunks = path.parse(image.sprite).name.match(/-([0-9]+)$/);
            var lineIndex = (spritePathChunks && parseInt(spritePathChunks[1])) || 0;

            image.y = image.y + (lineIndex * height);
            image.sprite = destinationPath;
            images.push(image);
          });
        });

        callback();
      });
    }
753299
function loadTemplate(template, name, callback) {
  async.waterfall([
    cb => source(template.path, template.filter, template.readMode, cb),
    (files, cb) => asDataMap(files, template.mapping, cb),
  ], (error, result) => {
    async.nextTick(callback, error, result);
  });
}
729950
function makeRequest(url, callback) {

  // The JSON file that is loaded should be an array of PageInfo:
  var searchDataRequest = new XMLHttpRequest();
  searchDataRequest.onload = function() {
    callback(JSON.parse(this.responseText));
  };
  searchDataRequest.open('GET', url);
  searchDataRequest.send();
}
1233053
function(text, root, callback) {
      var matches = this.extractUrls(text, root);

      // every call to process returns all the text this loader has ever received
      var done = callback.bind(null, this.map);
      this.fetch(matches, done);
    }
176158
function load (spec, callback) {
    if ((spec instanceof Array) ||
        Object.prototype.toString.call(spec) === "[object Array]") {
      if (callback) {
        // load multiple and join on callback
        var countdown = spec.length;
        for (var i=0;i<spec.length;++i) {(function(u){
          load(u, function (err) {
            if (err) {
              countdown = 0;
              //throw err;
              callback(err);
            } else if (--countdown === 0) {
              callback();
            }
          });
        })(spec[i]);}
      } else {
        // load multiple (blocking) -- don't use this for network resources
        for (var i=0;i<spec.length;++i) {
          load(spec[i]);
        }
      }
      return;
    } else if (typeof spec === 'string') {
      spec = {url:spec};
    }
    if (!spec.url && spec.id) {
      spec.url = spec.id + '.js';
    } else if (spec.url && !spec.id) {
      var m = /^[^\/]+\/\/[^\/]+\/(.+)$/.exec(spec.url);
      if (m) {
        spec.id = m[1];
      } else {
        spec.id = spec.url;
      }
      spec.id = spec.id.replace(/\.[^\.]+$/, '');
    } else if (!spec.url && !spec.id) {
      throw new TypeError('missing both "url" and "id"');
    }
    // normalize url
    spec.url = normalizeUrl(spec.url, window.location);
    var xhr = new XMLHttpRequest();
    var async = !!callback;
    function evalResponse() {
      try {
        eval('require.define("'+spec.id+'",'+
             ' "'+spec.url.replace(/"/g, '\\"')+'"'+
             ', function (require, module, exports) {'+xhr.responseText+'});');
      } catch (err) {
        err.message += ' in '+spec.url;
        throw err;
      }
    }
    xhr.open('GET', spec.url, async);
    if (async) {
      xhr.onreadystatechange = function (ev) {  
        if (xhr.readyState == 4) {
          if ((xhr.status < 300 && xhr.status >= 200)
            || (xhr.status === 0 && !spec.url.match(/^(?:https?|ftp):\/\//i))) {
            try {
              evalResponse();
              callback(null);
            } catch (err) {
              callback(err);
            }
          } else {
            callback(new Error('failed to load remote module with HTTP'+
                               ' response status '+xhr.status+' '+
                               xhr.responseText));
          }
        }
      };
    }
    xhr.send(null);
    if (!async) {
      evalResponse();
    }
  }
37392
function loadFields(list, callback) {
  list.forEach(loadMethods)

  function loadMethods(field) {
    var module = require('./fields/' + field + '.js')
      , methods

    if (typeof module === 'function' || typeof module === 'string') {
      methods = {}
      methods[field] = module
    }
    else {
      methods = module
    }

    callback(methods)
  }
}
517826
async function loadSources (sources, options) {
  const mergedConfig = {};

  function handleSourceLoad (sourceConfig) {
    if (sourceConfig) merge(sourceConfig, mergedConfig);
  }

  for (const source of sources) {
    let sourceConfig;

    if (source == null) {
            // No-op... skip this source
      continue;
    } else if (typeof source === 'string') {
            // Load a source from a JSON file
      sourceConfig = await loadFileSource(source, options);
    } else if (Array.isArray(source)) {
      sourceConfig = await loadSources(source, options); // Load and merge all of the sources
    } else if (typeof source === 'function') {
      sourceConfig = await source(); // Invoke the function to asynchronously load the config object for this source
    } else if (typeof source === 'object') {
      sourceConfig = source; // Just merge the object
    } else {
      throw new Error('Invalid configuration source: ' + source);
    }

    handleSourceLoad(sourceConfig);
  }

  return mergedConfig;
}
474800
function (callback) {

    var self = this;

    var warnings = null;

    async.series([
      // load saga files...
      function (callback) {
        if (self.options.sagaPath === '') {
          self.sagas = {};
          debug('empty sagaPath defined so no sagas will be loaded...');
          return callback(null);
        }
        debug('load saga files...');
        self.structureLoader(self.options.sagaPath, function (err, sagas, warns) {
          if (err) {
            return callback(err);
          }
          warnings = warns;
          self.sagas = attachLookupFunctions(sagas);
          callback(null);
        });
      },

      // prepare infrastructure...
      function (callback) {
        debug('prepare infrastructure...');
        async.parallel([

          // prepare sagaStore...
          function (callback) {
            debug('prepare sagaStore...');

            self.sagaStore.on('connect', function () {
              self.emit('connect');
            });

            self.sagaStore.on('disconnect', function () {
              self.emit('disconnect');
            });

            self.sagaStore.connect(callback);
          },

          // prepare revisionGuard...
          function (callback) {
            debug('prepare revisionGuard...');
            if (!self.revisionGuardStore) {
              return callback(null);
            }

            self.revisionGuardStore.on('connect', function () {
              self.emit('connect');
            });

            self.revisionGuardStore.on('disconnect', function () {
              self.emit('disconnect');
            });

            self.revisionGuardStore.connect(callback);
          }
        ], callback);
      },

      // inject all needed dependencies...
      function (callback) {
        debug('inject all needed dependencies...');

        if (self.revisionGuardStore) {
          self.revisionGuard = new RevisionGuard(self.revisionGuardStore, self.options.revisionGuard);
          self.revisionGuard.onEventMissing(function (info, evt) {
            self.onEventMissingHandle(info, evt);
          });
        }

        if (self.options.sagaPath !== '') {
          self.eventDispatcher = new EventDispatcher(self.sagas, self.definitions.event);
          self.sagas.defineOptions({}) // options???
            .defineCommand(self.definitions.command)
            .defineEvent(self.definitions.event)
            .idGenerator(self.getNewId)
            .useSagaStore(self.sagaStore);
        }

        if (self.revisionGuardStore) {
          self.revisionGuard.defineEvent(self.definitions.event);
        }

        callback(null);
      }
    ], function (err) {
      if (err) {
        debug(err);
      }
      if (callback) { callback(err, warnings); }
    });
  }
1039743
function onload() {
		// Create pattern
		pattern = ctx.createPattern(img, params.repeat);
		// Run callback function if defined
		if (params.load) {
			params.load.call($canvases[0], pattern);
		}
	}
1325762
function L10nResourceLink(link) {
            var href = link.href;
            // Note: If |gAsyncResourceLoading| is false, then the following callbacks
            // are synchronously called.
            this.load = function(lang, callback) {
                parseResource(href, lang, callback, function() {
                    console.warn(href + " not found.");
                    // lang not found, used default resource instead
                    console.warn('"' + lang + '" resource not found');
                    gLanguage = "";
                    // Resource not loaded, but we still need to call the callback.
                    callback();
                });
            };
        }
733975
function loadPrettyGraphSON(graph, filename, callback) {
        // We need to create an input stream and a reader, both of which are created asyncrously in parallel.
        // It would be nice to use Bluebird.join() perform those two operations, but the declaration for join()
        // in bluebird.d.ts isn't correct. We instead use .all(), and furthermore we use these two local variables
        // to commuicate the results of the two async operations to the final join operation.
        var theStream;
        var theReader;
        function getStream() {
            var readFileP = BluePromise.promisify(fs.readFile);
            return readFileP(filename, 'utf8')
                .then(function (jsonText) {
                var jsonObjArray = JSON.parse(jsonText);
                var jsonTextArray = _.map(jsonObjArray, JSON.stringify);
                return jsonTextArray.join('\n');
            })
                .then(function (uglyText) {
                var StringInputStream = Tinkerpop.autoImport('StringInputStream');
                theStream = StringInputStream.from(uglyText);
                return theStream;
            });
        }
        function getGraphReader() {
            return Tinkerpop.GraphSONReader.buildP()
                .then(function (builder) {
                return _newGraphSONMapper()
                    .then(function (mapper) { return builder.mapperP(mapper); });
            })
                .then(function (builder) { return builder.createP(); })
                .then(function (reader) { theReader = reader; return theReader; });
        }
        return BluePromise.all([getStream(), getGraphReader()])
            .then(function () { return theReader.readGraphP(theStream, graph); })
            .then(function () { return graph; })
            .nodeify(callback);
    }
336309
function load(url, successCallback, errorCallback) {
  const xhr = new XMLHttpRequest();

  // async, however scripts will be executed in the order they are in the
  // DOM to mirror normal script loading.
  xhr.open("GET", url, true);
  if ("overrideMimeType" in xhr) {
    xhr.overrideMimeType("text/plain");
  }
  xhr.onreadystatechange = function() {
    if (xhr.readyState === 4) {
      if (xhr.status === 0 || xhr.status === 200) {
        successCallback(xhr.responseText);
      } else {
        errorCallback();
        throw new Error("Could not load " + url);
      }
    }
  };
  return xhr.send(null);
}