我在Rhino上使用SyntaxError: missing } after property list
和以下无法编译的脚本:
importClass(org.scripthelper.js.samples.ScriptTag)
script11Class = new JavaAdapter(org.scripthelper.js.samples.ScriptTag, {
init: function(ctx) {
context = ctx;
}
function externalPressed() {
return 1;
}
});
错误在externalPressed
函数声明行上。
但是如果我通过以下方式更改代码:
importClass(org.scripthelper.js.samples.ScriptTag)
script11Class = new JavaAdapter(org.scripthelper.js.samples.ScriptTag, {
init: function(ctx) {
context = ctx;
},
externalPressed: function() {
return 1;
}
});
它正常工作。
我做错了什么?我确定第一种情况不是有效的Javascript,但我不明白为什么
{
init: function(ctx) {
context = ctx;
}
function externalPressed() {
return 1;
}
很明显,它显示了两个块。