Tag:

Node和Node-Webkit之间的奇速差(〜10ms VS〜520ms)

我注意到在简单的node.js VS node-webkit之间速度的显着差异 我正在做的是使用HTTP模块连接到本地主机couchdb。 相同的代码需要约520ms才能build立连接,并在node-webkit中返回一个响应,而在普通的node.js中需要~10ms 有更深入的node-webkit知识的人可以帮助解释是什么造成的? 代码如下 Class = new function() {}; Class.prototype.info = function(s) {console.log(console,s);} Class.prototype.err = function(s) {console.log(console,s);} Class.prototype.warning = function(s) {console.log(console,s);} Class.prototype.debug = function(s) {console.log(console,s);} Class.prototype.postMessage = function(oterm, msg) { __cb.shift().call(this, msg); } Class.prototype.onMsgFor = {}; Class.prototype.__agentkeepalive = require('agentkeepalive'); Class.prototype.__http = require("http"); Class.prototype.__follow = require("follow"); Class.prototype.__http.globalAgent.maxSockets = 1; Class.prototype._onInit = function(props) { […]

木偶 – 如何设置下载位置

我能够成功下载木偶的文件,但它只是保存到我的/ Downloads文件夹。 我一直在环顾四周,并找不到在API或论坛设置此位置的任何东西。 我的下载基本上只是去链接: await page.goto(url);

如何在Electron中使用<webview>方法

在Electron <webview> 文档中,可以使用该对象的一系列方法。 当我尝试运行任何方法时,它们都不起作用。 当我看着检查器中<webview>元素的属性时,它说它的原型是webview 。 ( __proto__ : webview ) 所有方法都存储在原型中。 所以当我使用这些方法时(例如myWebview.openDevTools() ),我的元素基本上应该从它的原型inheritance那些方法。 然而! 当我使用Object.getProptotypeOf(myWebview)我得到HTMLElement ,而不是像它显示在检查器中的Object.getProptotypeOf(myWebview) 。 这是我的代码的一个例子: <webview id="myWebview" src="path/to.file"></webview> <script> var myWebview = document.getElementById('myWebview'); console.log("myWebview: ",myWebview); console.log("prototype: ",Object.getPrototypeOf(myWebview)); //=> HTMLElement myWebview.openDevTools(); </script>

如何打开铬内的PDF文件?

我使用nodejs和铬为我的桌面应用程序。 问题是,我不能打开铬的PDF文件。 所以我GOOGLE了,发现大部分的答案都与mozplugger插件有关。 我按照下面的链接安装了插件: http://www.tootips.com/2013/01/how-to-open-pdf-files-inside-chromium.html 现在我得到一个错误消息:“ Mozplugger:M4parsingconfiguration生成的错误 ”当我尝试打开铬文件中的PDF文件。 我怎样才能解决这个错误? 请帮帮我!

ChromeOptions使用Selenium ChromeDriver for node.js导致引用错误

我正在尝试使用Chrome的ChromeDriver驱动程序来运行一些使用Chrome的testing,但是当我使用ChromeOptions时候出现了一个引用错误。 我的代码 我想强制使用某些选项,例如针对特定的用户configuration文件进行testing。 基于Selenium和ChromeDriver文档,这是我的文件test.js : opt = new chromeOptions(); // ERROR OCCURS HERE! opt.setBinary("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"); opt.addArguments("–user-data-dir=C:\\Users\\MyUserAccount\\AppData\\Local\\Google\\Chrome\\User Data"); driver = new ChromeDriver(opt); // rest of my script goes here 错误 我使用命令node test.js执行此操作。 这将在第一行中引发以下错误: \path\to\test.js:1 ction (exports, require, module, __filename, __dirname) { opt = new chromeOpti ^ ReferenceError: chromeOptions is not defined at Object.<anonymous> (\path\to\test.js:1:73) at […]