src/sap.ui.core/src/sap/ui/core/Core.js
function preloadLibraryAsync(libConfig) {

		var that = this;

		libConfig = evalLibConfig(libConfig);

		var lib = libConfig.name,
			fileType = libConfig.fileType,
			libPackage = lib.replace(/\./g, '/'),
			http2 = this.oConfiguration.getDepCache();

		if ( fileType === 'none' || !!sap.ui.loader._.getModuleState(libPackage + '/library.js') ) {
			return Promise.resolve(true);
		}

		var libInfo = mLibraryPreloadBundles[lib] || (mLibraryPreloadBundles[lib] = { });

		// return any existing promise (either lib is currently loading or has been loaded)
		if ( libInfo.promise ) {
			return libInfo.promise;
		}

		// otherwise mark as pending
		libInfo.pending = true;
		libInfo.async = true;

		// first preload code, resolves with list of dependencies (or undefined)
		var p;
		if ( fileType !== 'json' /* 'js' or 'both', not forced to JSON */ ) {
			var sPreloadModule = libPackage + (http2 ? '/library-h2-preload.js' : '/library-preload.js');
			p = sap.ui.loader._.loadJSResourceAsync(sPreloadModule).then(
					function() {
						return dependenciesFromManifest(lib);
					},
					function(e) {
						// loading library-preload.js failed, might be an old style lib with a library-preload.json only.
						// with json === false, this fallback can be suppressed
						if ( fileType !== 'js' /* 'both' */ ) {
							Log.error("failed to load '" + sPreloadModule + "' (" + (e && e.message || e) + "), falling back to library-preload.json");
							return loadJSONAsync(lib);
						}
						// ignore other errors
					}
				);
		} else {
			p = loadJSONAsync(lib);
		}

		// load dependencies, if there are any
		libInfo.promise = p.then(function(dependencies) {
			var aPromises = [],
				oManifest = getManifest(lib);

			if ( dependencies && dependencies.length ) {
				dependencies = VersionInfo._getTransitiveDependencyForLibraries(dependencies);
				aPromises = dependencies.map(preloadLibraryAsync.bind(that));
			}

			if (oManifest && Version(oManifest._version).compareTo("1.9.0") >= 0) {
				aPromises.push(that.getLibraryResourceBundle(lib, true));
			}

			return Promise.all(aPromises).then(function() {
				libInfo.pending = false;
			});
		});

		// return resulting promise
		return libInfo.promise;

	}
function preloadLibraryAsync(libConfig) {

		var that = this;

		libConfig = evalLibConfig(libConfig);

		var lib = libConfig.name,
			fileType = libConfig.fileType,
			libPackage = lib.replace(/\./g, '/'),
			http2 = this.oConfiguration.getDepCache();

		if ( fileType === 'none' || !!sap.ui.loader._.getModuleState(libPackage + '/library.js') ) {
			return Promise.resolve(true);
		}

		var libInfo = mLibraryPreloadBundles[lib] || (mLibraryPreloadBundles[lib] = { });

		// return any existing promise (either lib is currently loading or has been loaded)
		if ( libInfo.promise ) {
			return libInfo.promise;
		}

		// otherwise mark as pending
		libInfo.pending = true;
		libInfo.async = true;

		// first preload code, resolves with list of dependencies (or undefined)
		var p;
		if ( fileType !== 'json' /* 'js' or 'both', not forced to JSON */ ) {
			var sPreloadModule = libPackage + (http2 ? '/library-h2-preload.js' : '/library-preload.js');
			p = sap.ui.loader._.loadJSResourceAsync(sPreloadModule).then(
					function() {
						return dependenciesFromManifest(lib);
					},
					function(e) {
						// loading library-preload.js failed, might be an old style lib with a library-preload.json only.
						// with json === false, this fallback can be suppressed
						if ( fileType !== 'js' /* 'both' */ ) {
							Log.error("failed to load '" + sPreloadModule + "' (" + (e && e.message || e) + "), falling back to library-preload.json");
							return loadJSONAsync(lib);
						}
						// ignore other errors
					}
				);
		} else {
			p = loadJSONAsync(lib);
		}

		// load dependencies, if there are any
		libInfo.promise = p.then(function(dependencies) {
			var aPromises = [],
				oManifest = getManifest(lib);

			if ( dependencies && dependencies.length ) {
				dependencies = VersionInfo._getTransitiveDependencyForLibraries(dependencies);
				aPromises = dependencies.map(preloadLibraryAsync.bind(that));
			}

			if (oManifest && Version(oManifest._version).compareTo("1.9.0") >= 0) {
				aPromises.push(that.getLibraryResourceBundle(lib, true));
			}

			return Promise.all(aPromises).then(function() {
				libInfo.pending = false;
			});
		});

		// return resulting promise
		return libInfo.promise;

	}
function preloadLibraryAsync ( libConfig ) { var that = this ; libConfig = evalLibConfig ( libConfig ) ; var lib = libConfig . name , fileType = libConfig . fileType , libPackage = lib . replace ( / \. / g , '/' ) , http2 = this . oConfiguration . getDepCache ( ) ; if ( fileType === 'none' || ! ! sap . ui . loader . _ . getModuleState ( libPackage + '/library.js' ) ) { return Promise . resolve ( true ) ; } var libInfo = mLibraryPreloadBundles [ lib ] || ( mLibraryPreloadBundles [ lib ] = { } ) ; // return any existing promise (either lib is currently loading or has been loaded) if ( libInfo . promise ) { return libInfo . promise ; } // otherwise mark as pending libInfo . pending = true ; libInfo . async = true ; // first preload code, resolves with list of dependencies (or undefined) var p ; if ( fileType !== 'json' /* 'js' or 'both', not forced to JSON */ ) { var sPreloadModule = libPackage + ( http2 ? '/library-h2-preload.js' : '/library-preload.js' ) ; p = sap . ui . loader . _ . loadJSResourceAsync ( sPreloadModule ) . then ( function ( ) { return dependenciesFromManifest ( lib ) ; } , function ( e ) { // loading library-preload.js failed, might be an old style lib with a library-preload.json only. // with json === false, this fallback can be suppressed if ( fileType !== 'js' /* 'both' */ ) { Log . error ( "failed to load '" + sPreloadModule + "' (" + ( e && e . message || e ) + "), falling back to library-preload.json" ) ; return loadJSONAsync ( lib ) ; } // ignore other errors } ) ; } else { p = loadJSONAsync ( lib ) ; } // load dependencies, if there are any libInfo . promise = p . then ( function ( dependencies ) { var aPromises = [ ] , oManifest = getManifest ( lib ) ; if ( dependencies && dependencies . length ) { dependencies = VersionInfo . _getTransitiveDependencyForLibraries ( dependencies ) ; aPromises = dependencies . map ( preloadLibraryAsync . bind ( that ) ) ; } if ( oManifest && Version ( oManifest . _version ) . compareTo ( "1.9.0" ) >= 0 ) { aPromises . push ( that . getLibraryResourceBundle ( lib , true ) ) ; } return Promise . all ( aPromises ) . then ( function ( ) { libInfo . pending = false ; } ) ; } ) ; // return resulting promise return libInfo . promise ; }
Preloads a library asynchronously.

@param {string|object} libConfig Name of the library to preload or settings object describing library
@param {string} [libConfig.name] Name of the library to preload
@param {boolean|undefined} [libConfig.json] Whether library supports only JSON (<code>true</code>) or only JS (<code>false</code>)
or whether both should be tried (undefined)
@returns {Promise} A promise to be fulfilled when the library has been preloaded
@private
Preloads a library asynchronously .