/// <summary>
        /// Builds and returns a requirer to include with an engine.
        /// </summary>
        /// <param name="compiler">Compiles the required scripts if needed.</param>
        /// <param name="engine">The engine that will run the required script.</param>
        /// <returns></returns>
        internal static Requirer BuildRequirer(ScriptCompiler compiler, V8ScriptEngine engine)
        {
            var requirer = new Requirer
            {
                Compiler = compiler,
                Engine = engine
            };

            //Need to add this as a host object to the script
            requirer.Engine.AddHostObject("require", new Func<string, object>(requirer.Require));
            requirer.Engine.AddHostObject("requireNamed", new Func<string, string, object>(requirer.Require));

            return requirer;
        }
Exemple #2
0
        /// <summary>
        /// Builds and returns a requirer to include with an engine.
        /// </summary>
        /// <param name="compiler">Compiles the required scripts if needed.</param>
        /// <param name="engine">The engine that will run the required script.</param>
        /// <returns></returns>
        internal static Requirer BuildRequirer(ScriptCompiler compiler, V8ScriptEngine engine)
        {
            var requirer = new Requirer
            {
                Compiler = compiler,
                Engine   = engine
            };

            //Need to add this as a host object to the script
            requirer.Engine.AddHostObject("require", new Func <string, object>(requirer.Require));
            requirer.Engine.AddHostObject("requireNamed", new Func <string, string, object>(requirer.Require));

            return(requirer);
        }