Nodejs:`process.binding`是什么意思? [英] Nodejs: What does `process.binding` mean?

查看:180
本文介绍了Nodejs:`process.binding`是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过 process.binding('...')多次gnub上的/node\">node.js源代码

I've seen process.binding('...') many times while researching through the node.js source code on github.

有人可以解释一下这个函数是做什么的吗?

Can anybody explain me what this function does?

推荐答案

此函数返回内部模块,如require。它不是公开的,所以你不应该在你的代码中依赖它,但你可以用它来玩节点的低级对象,如果你想了解它是如何工作的。

This function returns internal module, like require. It's not public, so you shouldn't rely on it in your code, but you can use it to play with node's low level objects, if you want to understand how things work.

例如,此处 timer_wrap 绑定已注册。它导出 计时器构造函数。在 lib / timers.js 中,它是导入

For example, here timer_wrap binding is registered. It exports Timer constructor. In lib/timers.js it's imported

这篇关于Nodejs:`process.binding`是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆