Tag: 原生

使用node-gyp构build时无法加载node.js本机插件,但在使用Visual Studio构build时可以使用

我已经为node.js编写了一个本地插件,使用不带node-gyp的MSVC ++对其进行编译,并在节点REPL和应用程序中成功使用它。 我正在使用x64节点并编译一个x64插件。 我试图用node-gyp来构build这个东西。 我已经得到node-gyp来生成一个Visual Studio解决scheme并编译它,但出来的插件不起作用。 我得到的唯一错误是这样的: Error: The specified procedure could not be found. at Object.Module._extensions..node (module.js:480:11) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:362:17) at require (module.js:378:17) at repl:1:13 at REPLServer.self.eval (repl.js:111:21) at rli.on.e (repl.js:260:20) at REPLServer.self.eval (repl.js:118:5) at Interface.<anonymous> (repl.js:250:12) 当我运行一个脚本,试图加载插件,我得到这个: module.js:480 process.dlopen(filename, module.exports); ^ Error: The specified procedure could not […]

NodeJS本地鼠标和键盘绑定

我一直在寻找一个支持鼠标和键盘监听和执行的本地nodejs模块 我发现这.. https://npmjs.org/package/mouse但源代码看起来像只支持浏览器。

如何确定一个JavaScript函数是本地的(没有testing'')

我想知道是否有一种方法可以区分JavaScript脚本函数( function(){} )和JavaScript本地函数(如Math.cos )。 我已经知道了func.toString().indexOf('[native code]') != -1技巧,但我想知道是否有另一种方法来检测它。 背景: 我需要创build一个No-op转发ES6代理,它可以处理对象上的本机函数,但是它会因TypeError: Illegal invocation (请参阅使用ES6代理和node.js的非法调用错误 )而失败。 为了解决这个问题,我在我的代理服务器的get处理程序中.bind()所有的函数,但是如果我能够有效地检测本机函数,我只需要.bind()这些原生函数。 更多细节: https : //github.com/FranckFreiburger/module-invalidate/blob/master/index.js#L106 注意: (function() {}).toString() -> "function () {}" (function() {}).prototype -> {} (require('os').cpus).toString() -> "function getCPUs() { [native code] }" (require('os').cpus).prototype -> getCPUs {} (Math.cos).toString() -> "function cos() { [native code] }" (Math.cos).prototype -> undefined (Promise.resolve().then).toString() -> […]