protected override void Prepare()
 {
     engine = new ChakraCoreJsEngine();
     engine.EmbedHostObject("log", new Action <object>(Console.WriteLine));
     engine.Execute("const window = this;");
     engine.Execute("const exports = {};");
     engine.Execute(Compiler);
     if (!engine.HasVariable("transform"))
     {
         throw new InvalidOperationException("Missing compiler");
     }
 }
Example #2
0
 public void AddHostObject(string itemName, object target)
 {
     _scriptEngine.EmbedHostObject(itemName, target);
 }
 public void InitializeEngine()
 {
     // Todo add proper logging
     engine.EmbedHostObject("Console", Console);
 }