我在下面写了代码
static void Main(string[] args)
{
var engine = new Engine();
var file = File.ReadAllText(@"...\Desktop\beautify.js");
var final = file + Environment.NewLine + "(function () {return js_beautify('var a = 2;');})();";
var exec = engine.Execute(final);
var r = exec.GetCompletionValue().ToString();
Console.WriteLine(r);
Console.Read();
}
但 Jint 显示错误
Jint.Runtime.JavaScriptException: 'js_beautify is not defined'
谁能帮助我如何注册外部 js 库,如 beautify.js,然后在 Jint 中调用它们的函数?