Skip to content

Instantly share code, notes, and snippets.

@masak
Created April 28, 2009 12:03
Show Gist options
  • Save masak/103101 to your computer and use it in GitHub Desktop.
Save masak/103101 to your computer and use it in GitHub Desktop.
private static Map<String, String[]> topLevelCommands
= new HashMap<String, String[]>() {{
// { "fn name" => [ "parameters", "fn body" ] }
put("clear", new String[] { "", "js.clear()" } );
put("print", new String[] { "message", "js.print(message)" } );
put("say", new String[] { "message", "js.say(message)" } );
}};
static {
for (Map.Entry<String, String[]> e : topLevelCommands.entrySet())
jsThread.enqueue( "function " + e.getKey()
+ "(" + e.getValue()[0] + ")"
+ " { " + e.getValue()[1] + " }" );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment