/// <summary> /// Ensures any user-provided scripts have been loaded /// </summary> 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) { var contents = JsxTransformer.TransformJsxFile(file); try { Execute(contents); } catch (JsRuntimeException ex) { throw new ReactScriptLoadException(string.Format( "Error while loading \"{0}\": {1}", file, ex.Message )); } } Engine.SetVariableValue(USER_SCRIPTS_LOADED_KEY, true); }
/// <summary> /// Ensures any user-provided scripts have been loaded /// </summary> private 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) { var contents = JsxTransformer.TransformJsxFile(file); Execute(contents); } Engine.SetVariableValue(USER_SCRIPTS_LOADED_KEY, true); }
public string TransformJsx(string input) { return(JsxTransformer.TransformJsx(input)); }
public string LoadJsxFile(string filename) { return(JsxTransformer.TransformJsxFile(filename)); }