将多行粘贴到phantomjs交互式会话中
我正在尝试通过命令行以交互方式调试脚本。如果粘贴多行命令,解释器似乎无法解析返回的行。例如,试图粘贴将多行粘贴到phantomjs交互式会话中,phantomjs,Phantomjs,我正在尝试通过命令行以交互方式调试脚本。如果粘贴多行命令,解释器似乎无法解析返回的行。例如,试图粘贴 page.onConsoleMessage = function(msg) { console.log(msg); }; 在以下情况下失败: phantomjs> page.onConsoleMessage = function(msg) { Expected token '}' phantomjs://repl-input:1 in global code phantomjs
page.onConsoleMessage = function(msg) {
console.log(msg);
};
在以下情况下失败:
phantomjs> page.onConsoleMessage = function(msg) {
Expected token '}'
phantomjs://repl-input:1 in global code
phantomjs> console.log(msg);
Can't find variable: msg
phantomjs://repl-input:1 in global code
phantomjs> };
Parser error
phantomjs://repl-input:1 in global code
是否有任何方法可以使虚线返回或期望多行注释?似乎应该支持这种方法-两者都不起作用-使用反勾号(
无效字符
),并使用\
转义文字换行符(后者失败,出现意外EOFphantomjs://repl-input:1 在全局代码中
)。与+
的字符串连接也会失败,并出现后一个错误。