Native Abstractions for Node.js
===============================
**A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10, 0.12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 and 14.**
***Current version: 2.14.2***
*(See [CHANGELOG.md](https://github.com/nodejs/nan/blob/master/CHANGELOG.md) for complete ChangeLog)*
[![NPM](https://nodei.co/npm/nan.png?downloads=true&downloadRank=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6&height=3)](https://nodei.co/npm/nan/)
[![Build Status](https://api.travis-ci.org/nodejs/nan.svg?branch=master)](https://travis-ci.org/nodejs/nan)
[![Build status](https://ci.appveyor.com/api/projects/status/kh73pbm9dsju7fgh)](https://ci.appveyor.com/project/RodVagg/nan)
Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle.
This project also contains some helper utilities that make addon development a bit more pleasant.
* **[News & Updates](#news)**
* **[Usage](#usage)**
* **[Example](#example)**
* **[API](#api)**
* **[Tests](#tests)**
* **[Known issues](#issues)**
* **[Governance & Contributing](#governance)**
<a name="news"></a>
## News & Updates
<a name="usage"></a>
## Usage
Simply add **NAN** as a dependency in the *package.json* of your Node addon:
``` bash
$ npm install --save nan
```
Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include <nan.h>` in your *.cpp* files:
``` python
"include_dirs" : [
"<!(node -e \"require('nan')\")"
]
```
This works like a `-I<path-to-NAN>` when compiling your addon.
<a name="example"></a>
## Example
Just getting started with Nan? Take a look at the **[Node Add-on Examples](https://github.com/nodejs/node-addon-examples)**.
Refer to a [quick-start **Nan** Boilerplate](https://github.com/fcanas/node-native-boilerplate) for a ready-to-go project that utilizes basic Nan functionality.
For a simpler example, see the **[async pi estimation example](https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**.
Yet another example is **[nan-example-eol](https://github.com/CodeCharmLtd/nan-example-eol)**. It shows newline detection implemented as a native addon.
Also take a look at our comprehensive **[C++ test suite](https://github.com/nodejs/nan/tree/master/test/cpp)** which has a plethora of code snippets for your pasting pleasure.
<a name="api"></a>
## API
Additional to the NAN documentation below, please consult:
* [The V8 Getting Started * Guide](https://v8.dev/docs/embed)
* [V8 API Documentation](https://v8docs.nodesource.com/)
* [Node Add-on Documentation](https://nodejs.org/api/addons.html)
<!-- START API -->
### JavaScript-accessible methods
A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://github.com/v8/v8/wiki/Embedder%27s-Guide#templates) for further information.
In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type.
* **Method argument types**
- <a href="doc/methods.md#api_nan_function_callback_info"><b><code>Nan::FunctionCallbackInfo</code></b></a>
- <a href="doc/methods.md#api_nan_property_callback_info"><b><code>Nan::PropertyCallbackInfo</code></b></a>
- <a href="doc/methods.md#api_nan_return_value"><b><code>Nan::ReturnValue</code></b></a>
* **Method declarations**
- <a href="doc/methods.md#api_nan_method"><b>Method declaration</b></a>
- <a href="doc/methods.md#api_nan_getter"><b>Getter declaration</b></a>
- <a href="doc/methods.md#api_nan_setter"><b>Setter declaration</b></a>
- <a href="doc/methods.md#api_nan_property_getter"><b>Property getter declaration</b></a>
- <a href="doc/methods.md#api_nan_property_setter"><b>Property setter declaration</b></a>
- <a href="doc/methods.md#api_nan_property_enumerator"><b>Property enumerator declaration</b></a>
- <a href="doc/methods.md#api_nan_property_deleter"><b>Property deleter declaration</b></a>
- <a href="doc/methods.md#api_nan_property_query"><b>Property query declaration</b></a>
- <a href="doc/methods.md#api_nan_index_getter"><b>Index getter declaration</b></a>
- <a href="doc/methods.md#api_nan_index_setter"><b>Index setter declaration</b></a>
- <a href="doc/methods.md#api_nan_index_enumerator"><b>Index enumerator declaration</b></a>
- <a href="doc/methods.md#api_nan_index_deleter"><b>Index deleter declaration</b></a>
- <a href="doc/methods.md#api_nan_index_query"><b>Index query declaration</b></a>
* Method and template helpers
- <a href="doc/methods.md#api_nan_set_method"><b><code>Nan::SetMethod()</code></b></a>
- <a href="doc/methods.md#api_nan_set_prototype_method"><b><code>Nan::SetPrototypeMethod()</code></b></a>
- <a href="doc/methods.md#api_nan_set_accessor"><b><code>Nan::SetAccessor()</code></b></a>
- <a href="doc/methods.md#api_nan_set_named_property_handler"><b><code>Nan::SetNamedPropertyHandler()</code></b></a>
- <a href="doc/methods.md#api_nan_set_indexed_property_handler"><b><code>Nan::SetIndexedPropertyHandler()</code></b></a>
- <a href="doc/methods.md#api_nan_set_template"><b><code>Nan::SetTemplate()</code></b></a>
- <a href="doc/methods.md#api_nan_set_prototype_template"><b><code>Nan::SetPrototypeTemplate()</code></b></a>
- <a href="doc/methods.md#api_nan_set_instance_template"><b><code>Nan::SetInstanceTemplate()</code></b></a>
- <a href="doc/methods.md#api_nan_set_call_handler"><b><code>Nan::SetCallHandler()</code></b></a>
- <a href="doc/methods.md#api_nan_set_call_as_function_handler"><b><code>Nan::SetCallAsFunctionHandler()</code></b></a>
### Scopes
A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works.
A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope.
The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these.
- <a href="doc/scopes.md#api_nan_handle_scope"><b><code>Nan::HandleScope</code></b></a>
- <a href="doc/scopes.md#api_nan_escapable_handle_scope"><b><code>Nan::EscapableHandleScope</code></b></a>
Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://github.com/v8/v8/wiki/Embedder%27s%20Guide#handles-and-garbage-collection).
### Persistent references
An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed.
Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported.
- <a href="doc/persistent.md#api_nan_persistent_base"><b><code>Nan::Persi
没有合适的资源?快使用搜索试试~ 我知道了~
arduino-ide-2.2.1-Windows-64bit
共2000个文件
md:699个
json:559个
js:555个
需积分: 0 67 下载量 23 浏览量
2023-10-11
15:51:54
上传
评论 1
收藏 178.81MB ZIP 举报
温馨提示
上传的这是文件是Arduino IDE软件安装包,安装包是压缩包,版本为arduino-2.2,我用的是win10系统,经测试已OK。
资源推荐
资源详情
资源评论
收起资源包目录
arduino-ide-2.2.1-Windows-64bit (2000个子文件)
serialport_win.cpp 30KB
serialport_win.cpp 30KB
serialport.cpp 13KB
serialport.cpp 13KB
darwin_list.cpp 12KB
darwin_list.cpp 12KB
serialport_unix.cpp 11KB
serialport_unix.cpp 11KB
poller.cpp 4KB
poller.cpp 4KB
serialport_linux.cpp 747B
serialport_linux.cpp 747B
main.a73b3516.chunk.css 7KB
nan.h 86KB
nan.h 86KB
nan.h 86KB
nan_callbacks_12_inl.h 17KB
nan_callbacks_12_inl.h 17KB
nan_callbacks_12_inl.h 17KB
nan_callbacks_pre_12_inl.h 17KB
nan_callbacks_pre_12_inl.h 17KB
nan_callbacks_pre_12_inl.h 17KB
nan_weak.h 15KB
nan_weak.h 15KB
nan_weak.h 15KB
nan_implementation_12_inl.h 15KB
nan_implementation_12_inl.h 15KB
nan_implementation_12_inl.h 15KB
nan_maybe_43_inl.h 12KB
nan_maybe_43_inl.h 12KB
nan_maybe_43_inl.h 12KB
nan_new.h 9KB
nan_new.h 9KB
nan_new.h 9KB
nan_string_bytes.h 8KB
nan_string_bytes.h 8KB
nan_string_bytes.h 8KB
nan_implementation_pre_12_inl.h 8KB
nan_implementation_pre_12_inl.h 8KB
nan_implementation_pre_12_inl.h 8KB
nan_maybe_pre_43_inl.h 7KB
nan_maybe_pre_43_inl.h 7KB
nan_maybe_pre_43_inl.h 7KB
nan_persistent_pre_12_inl.h 6KB
nan_persistent_pre_12_inl.h 6KB
nan_persistent_pre_12_inl.h 6KB
nan_json.h 6KB
nan_json.h 6KB
nan_json.h 6KB
nan_object_wrap.h 4KB
nan_object_wrap.h 4KB
nan_object_wrap.h 4KB
nan_persistent_12_inl.h 4KB
nan_persistent_12_inl.h 4KB
nan_persistent_12_inl.h 4KB
serialport.h 4KB
serialport.h 4KB
nan_callbacks.h 3KB
nan_typedarray_contents.h 3KB
nan_callbacks.h 3KB
nan_typedarray_contents.h 3KB
nan_callbacks.h 3KB
nan_typedarray_contents.h 3KB
nan_converters_43_inl.h 3KB
nan_converters_43_inl.h 3KB
nan_converters_43_inl.h 3KB
nan_private.h 2KB
nan_private.h 2KB
nan_private.h 2KB
nan_converters.h 2KB
nan_converters.h 2KB
nan_converters.h 2KB
pitches.h 2KB
pitches.h 2KB
serialport_win.h 2KB
serialport_win.h 2KB
nan_converters_pre_43_inl.h 1KB
nan_converters_pre_43_inl.h 1KB
nan_converters_pre_43_inl.h 1KB
darwin_list.h 1KB
darwin_list.h 1KB
nan_define_own_property_helper.h 1KB
nan_define_own_property_helper.h 1KB
nan_define_own_property_helper.h 1KB
poller.h 815B
poller.h 815B
serialport_linux.h 295B
serialport_linux.h 295B
serialport_unix.h 237B
serialport_unix.h 237B
index.html 6KB
index.html 3KB
secondary-window.html 869B
index.html 480B
fake.html 246B
bundle.js 11.99MB
main.js 6.82MB
electron-main.js 3.87MB
plugin-host.js 3.29MB
777.js 2.19MB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
larry401
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 上市公司-股票性质数据-工具变量(民企、国企、央企)2003-2022年.dta
- 上市公司-股票性质数据-工具变量(民企、国企、央企)2003-2022年.xlsx
- Reeds+Shepp曲线算法讲解和实现.pdf
- 毕业设计基于SpringBoot+MyBatisPlus+MySQL+Vue的外卖配送信息系统源代码+数据库
- 词向量(Word Embeddings)是自然语言处理(NLP)领域的一种重要技术.txt
- Surfer,线性函数
- MyBatis 的动态 SQL 是其核心特性之一.txt
- 时代的sdddsddsddsd
- 基于哈希链表的简单人员信息管理系统
- 其他类别JdonFramework开源框架 v5.1 Build20071025-jdonframework-5.1.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功