我正在使用最新的 nodewebkit 并根据文档(https://github.com/rogerwang/node-webkit/wiki/Screen)运行以下代码,但它总是失败。谁能告诉我为什么我有这个错误,你如何解决它?
<!DOCTYPE html>
<html>
<body>
<script>
function ScreenToString(screen) {
var string = "";
string += "screen: "+ screen.id;
return string;
}
var gui = require('nw.gui');
gui.Screen.Init();
var string = "" ;
var screens = gui.Screen.screens;
for(var i=0;i<screens.length; i++) {
string += ScreenToString(screens[i]);
}
document.write(string);
</script>
</body>
</html>
错误:
Uncaught node.js Error
SyntaxError: Unexpected end of input
at Object.parse (native)
at Screen.screens (screen.js:65:15)
at file:///C:/Users/xxx/Downloads/node-webkit-v0.11.0-pre-win-x64/node-webkit-v0.11.0-pre-win-x64/test.html:14:28