Current section

Files

Jump to
execjs priv rhino_runner.js.eex
Raw

priv/rhino_runner.js.eex

(function(program, runner) { runner(program); })(function() {
return <%= source %>;
}, function(program) {
var result;
try {
result = program();
try {
if (result === undefined) {
java.lang.System.out.println('["ok"]');
} else {
java.lang.System.out.println(JSON.stringify(['ok', result]));
}
} catch (err) {
java.lang.System.out.println('["err"]');
}
} catch (err) {
java.lang.System.out.println(JSON.stringify(['err', '' + err]));
}
});