Exemplo n.º 1
0
 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");
     }
 }
Exemplo n.º 2
0
 public void AddHostObject(string itemName, object target)
 {
     _scriptEngine.EmbedHostObject(itemName, target);
 }
 public void InitializeEngine()
 {
     // Todo add proper logging
     engine.EmbedHostObject("Console", Console);
 }