Skip to content

Instantly share code, notes, and snippets.

@oifland
Created February 29, 2012 23:07
Show Gist options
  • Save oifland/1945246 to your computer and use it in GitHub Desktop.
Save oifland/1945246 to your computer and use it in GitHub Desktop.
A simple console for executing JS commands against IronJs
static void Main(string[] args)
{
var context = new IronJS.Hosting.CSharp.Context();
Console.WriteLine("Type a JS expression below and press enter. (Blank line to quit.)");
Console.Write("js-console> ");
string command = Console.ReadLine();
while (command != "" && command != "exit")
{
try
{
Console.WriteLine(context.Execute(command));
}
catch (Exception ex)
{
Console.WriteLine("Oops. Got an error: \n" + ex.Message);
}
Console.Write("\njs-console> ");
command = Console.ReadLine();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment