bower_components/prism/examples.js
function loadLanguage (lang)
{
	// at first we need to fetch all dependencies for the main language
	// Note: we need to do this, even if the main language already is loaded (just to be sure..)
	//
	// We load an array of all dependencies and call recursively this function on each entry
	//
	// dependencies is now an (possibly empty) array of loading-promises
	var dependencies = getDependenciesOfLanguage(lang).map(loadLanguage);

	// We create a promise, which will resolve, as soon as all dependencies are loaded.
	// They need to be fully loaded because the main language may extend them.
	return Promise.all(dependencies)
		.then(function () {

			// If the main language itself isn't already loaded, load it now
			// and return the newly created promise (we chain the promises).
			// If the language is already loaded, just do nothing - the next .then()
			// will immediately be called
			if (!Prism.languages[lang]) {
				return new Promise(function (resolve) {
					$u.script('components/prism-' + lang + '.js', resolve);
				});
			}
		});
}
function loadLanguage (lang)
{
	// at first we need to fetch all dependencies for the main language
	// Note: we need to do this, even if the main language already is loaded (just to be sure..)
	//
	// We load an array of all dependencies and call recursively this function on each entry
	//
	// dependencies is now an (possibly empty) array of loading-promises
	var dependencies = getDependenciesOfLanguage(lang).map(loadLanguage);

	// We create a promise, which will resolve, as soon as all dependencies are loaded.
	// They need to be fully loaded because the main language may extend them.
	return Promise.all(dependencies)
		.then(function () {

			// If the main language itself isn't already loaded, load it now
			// and return the newly created promise (we chain the promises).
			// If the language is already loaded, just do nothing - the next .then()
			// will immediately be called
			if (!Prism.languages[lang]) {
				return new Promise(function (resolve) {
					$u.script('components/prism-' + lang + '.js', resolve);
				});
			}
		});
}
function loadLanguage ( lang ) { // at first we need to fetch all dependencies for the main language // Note: we need to do this, even if the main language already is loaded (just to be sure..) // // We load an array of all dependencies and call recursively this function on each entry // // dependencies is now an (possibly empty) array of loading-promises var dependencies = getDependenciesOfLanguage ( lang ) . map ( loadLanguage ) ; // We create a promise, which will resolve, as soon as all dependencies are loaded. // They need to be fully loaded because the main language may extend them. return Promise . all ( dependencies ) . then ( function ( ) { // If the main language itself isn't already loaded, load it now // and return the newly created promise (we chain the promises). // If the language is already loaded, just do nothing - the next .then() // will immediately be called if ( ! Prism . languages [ lang ] ) { return new Promise ( function ( resolve ) { $u . script ( 'components/prism-' + lang + '.js' , resolve ) ; } ) ; } } ) ; }
Loads a language, including all dependencies

@param {string} lang the language to load
@type {Promise} the promise which resolves as soon as everything is loaded
Loads a language including all dependencies