I have a SyntaxError: missing } after property list
using Rhino with the following script which does not compile:
importClass(org.scripthelper.js.samples.ScriptTag)
script11Class = new JavaAdapter(org.scripthelper.js.samples.ScriptTag, {
init: function(ctx) {
context = ctx;
}
function externalPressed() {
return 1;
}
});
The error is on the externalPressed
function declaration line.
But if I change my code by:
importClass(org.scripthelper.js.samples.ScriptTag)
script11Class = new JavaAdapter(org.scripthelper.js.samples.ScriptTag, {
init: function(ctx) {
context = ctx;
},
externalPressed: function() {
return 1;
}
});
It works correctly.
What did I do wrong? I'm sure that the first case is not valid Javascript, but I dont see why
Because There's not a valid constructor. Also, what the compiler will interpret in the following lines.
{
init: function(ctx) {
context = ctx;
}
function externalPressed() {
return 1;
}
Clearly, It shows two blocks.