protected virtual void EnsureUserScriptsLoaded()

in src/React.Core/ReactEnvironment.cs [190:223]


		protected virtual void EnsureUserScriptsLoaded()
		{
			// Scripts already loaded into this environment, don't load them again
			if (Engine.HasVariable(USER_SCRIPTS_LOADED_KEY) || _config == null)
			{
				return;
			}

			foreach (var file in _config.Scripts)
			{
				try
				{
					if (_config.AllowJavaScriptPrecompilation
						&& Engine.TryExecuteFileWithPrecompilation(_cache, _fileSystem, file, Babel.TransformFile))
					{
						// Do nothing.
					}
					else
					{
						var contents = Babel.TransformFile(file);
						Engine.Execute(contents, file);
					}
				}
				catch (JsException ex)
				{
					throw new ReactScriptLoadException(string.Format(
						"Error while loading \"{0}\": {1}",
						file,
						ex.Message
					), ex);
				}
			}
			Engine.SetVariableValue(USER_SCRIPTS_LOADED_KEY, true);
		}