Created
February 29, 2012 23:07
-
-
Save oifland/1945246 to your computer and use it in GitHub Desktop.
A simple console for executing JS commands against IronJs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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