Node.js 的原生抽象


【Native abstractions for Node.js】

本文档中展示的每个示例都直接使用 Node.js 和 V8 的 API 来实现插件。V8 的 API 会随着每个发布版本(以及每个主要的 Node.js 版本)发生巨大变化。每次变化之后,插件可能需要更新和重新编译才能继续运行。Node.js 的发布计划旨在尽量减少此类变化的频率和影响,但 Node.js 对于确保 V8 API 的稳定性几乎无能为力。

【Each of the examples illustrated in this document directly use the Node.js and V8 APIs for implementing addons. The V8 API can, and has, changed dramatically from one V8 release to the next (and one major Node.js release to the next). With each change, addons may need to be updated and recompiled in order to continue functioning. The Node.js release schedule is designed to minimize the frequency and impact of such changes but there is little that Node.js can do to ensure stability of the V8 APIs.】

Node.js 的原生抽象(或 nan)提供了一套工具,建议插件开发者使用这些工具,以保持 V8 和 Node.js 不同版本之间的兼容性。请参阅 nan 例子,了解它如何使用的示例。

【The Native Abstractions for Node.js (or nan) provide a set of tools that addon developers are recommended to use to keep compatibility between past and future releases of V8 and Node.js. See the nan examples for an illustration of how it can be used.】