Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
 public string LoadJsxFile(string filename)
 {
     return(JsxTransformer.TransformJsxFile(filename));
 }