Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nan

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nan - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

package.json
{
"name": "nan",
"version": "1.0.0",
"version": "1.1.0",
"description": "Native Abstractions for Node.js: C++ header for Node 0.8->0.12 compatibility",

@@ -5,0 +5,0 @@ "main": "include_dirs.js",

@@ -6,3 +6,3 @@ Native Abstractions for Node.js

***Current version: 1.0.0*** *(See [nan.h](https://github.com/rvagg/nan/blob/master/nan.h) for complete ChangeLog)*
***Current version: 1.1.0*** *(See [nan.h](https://github.com/rvagg/nan/blob/master/nan.h) for complete ChangeLog)*

@@ -23,4 +23,13 @@ [![NPM](https://nodei.co/npm/nan.png?downloads=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6)](https://nodei.co/npm/nan/)

### May-2013: Major changes for V8 3.25 / Node 0.11.13
### May-2014: 1.1.0 release
* We've deprecated `NanSymbol()`, you should just use `NanNew<String>()` now.
* `NanNull()`, `NanUndefined()`, `NanTrue()`, `NanFalse()` all return `Local`s now.
* `nan_isolate` is gone, it was intended to be internal-only but if you were using it then you should switch to `v8::Isolate::GetCurrent()`.
* `NanNew()` has received some additional overload-love so you should be able to give it many kinds of values without specifying the `<Type>`.
* Lots of small fixes and additions to expand the V8 API coverage, *use the source, Luke*.
### May-2014: Major changes for V8 3.25 / Node 0.11.13
Node 0.11.11 and 0.11.12 were both broken releases for native add-ons, you simply can't properly compile against either of them for different reasons. But we now have a 0.11.13 release that jumps a couple of versions of V8 ahead and includes some more, major (traumatic) API changes.

@@ -30,3 +39,3 @@

We have **removed support for Node 0.11 versions prior to 0.11.13**, (although our tests are still passing for 0.11.10). As usual, our tests are run against (and pass) the last 5 versions of Node 0.8 and Node 0.10. We also include Node 0.11.13 obviously.
We have **removed support for Node 0.11 versions prior to 0.11.13**. As usual, our tests are run against (and pass) the last 5 versions of Node 0.8 and Node 0.10. We also include Node 0.11.13 obviously.

@@ -41,3 +50,3 @@ The major change is something that [Benjamin Byholm](kkoopa) has put many hours in to. We now have a fantastic new `NanNew<T>(args)` interface for creating new `Local`s, this replaces `NanNewLocal()` and much more. If you look in [./nan.h](nan.h) you'll see a large number of overloaded versions of this method. In general you should be able to `NanNew<Type>(arguments)` for any type you want to make a `Local` from. This includes `Persistent` types, so we now have a `Local<T> NanNew(const Persistent<T> arg)` to replace `NanPersistentToLocal()`.

Because `node::MakeCallback()` now takes an `Isolate`, and because it doesn't exist in older versions of Node, we've introduced `NanMakeCallabck()`. You should *always* use this when calling a JavaScript function from C++.
Because `node::MakeCallback()` now takes an `Isolate`, and because it doesn't exist in older versions of Node, we've introduced `NanMakeCallback()`. You should *always* use this when calling a JavaScript function from C++.

@@ -99,8 +108,9 @@ There's lots more, check out the Changelog in nan.h or look through [#86](https://github.com/rvagg/nan/pull/86) for all the gory details.

using v8::Object;
using v8::String;
void InitAll(Handle<Object> exports) {
exports->Set(NanSymbol("calculateSync"),
exports->Set(NanNew<String>("calculateSync"),
NanNew<FunctionTemplate>(CalculateSync)->GetFunction());
exports->Set(NanSymbol("calculateAsync"),
exports->Set(NanNew<String>("calculateAsync"),
NanNew<FunctionTemplate>(CalculateAsync)->GetFunction());

@@ -176,3 +186,3 @@ }

Local<Value> argv[] = {
NanNew(NanNull())
NanNull()
, NanNew<Number>(estimate)

@@ -237,3 +247,3 @@ };

* <a href="#api_nan_object_wrap_handle"><b><code>NanObjectWrapHandle</code></b></a>
* <a href="#api_nan_symbol"><b><code>NanSymbol</code></b></a>
* <del><a href="#api_nan_symbol"><b><code>NanSymbol</code></b></a></del>
* <a href="#api_nan_get_pointer_safe"><b><code>NanGetPointerSafe</code></b></a>

@@ -377,3 +387,3 @@ * <a href="#api_nan_set_pointer_safe"><b><code>NanSetPointerSafe</code></b></a>

Use `NAN_WEAK_CALLBACK` to define your V8 WeakReference callbacks. Do not use for declaration. There is an argument object `const _NanWeakCallbackData<T, P> &data` allowing access to the weak object and the supplied parameter through its `GetValue` and `GetParameter` methods.
Use `NAN_WEAK_CALLBACK` to define your V8 WeakReference callbacks. Do not use for declaration. There is an argument object `const _NanWeakCallbackData<T, P> &data` allowing access to the weak object and the supplied parameter through its `GetValue` and `GetParameter` methods. You can even access the weak callback info object through the `GetCallbackInfo()`method, but you probably should not. `Revive()` keeps the weak object alive until the next GC round.

@@ -388,3 +398,2 @@ ```c++

delete parameter;
data.Dispose();
}

@@ -433,3 +442,3 @@ }

<a name="api_nan_undefined"></a>
### Handle&lt;Primitive&gt; NanUndefined()
### Local&lt;Primitive&gt; NanUndefined()

@@ -439,3 +448,3 @@ Use instead of `Undefined()`

<a name="api_nan_null"></a>
### Handle&lt;Primitive&gt; NanNull()
### Local&lt;Primitive&gt; NanNull()

@@ -445,3 +454,3 @@ Use instead of `Null()`

<a name="api_nan_true"></a>
### Handle&lt;Primitive&gt; NanTrue()
### Local&lt;Boolean&gt; NanTrue()

@@ -451,3 +460,3 @@ Use instead of `True()`

<a name="api_nan_false"></a>
### Handle&lt;Primitive&gt; NanFalse()
### Local&lt;Boolean&gt; NanFalse()

@@ -513,3 +522,3 @@ Use instead of `False()`

The introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanScope()` necessary, use it in place of `HandleScope scope`:
The introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanScope()` necessary, use it in place of `HandleScope scope` when you do not wish to return handles (`Handle` or `Local`) to the surrounding scope (or in functions directly exposed to V8, as they do not return values in the normal sense):

@@ -524,6 +533,18 @@ ```c++

This method is not directly exposed to V8, nor does it return a handle, so it uses an unescapable scope:
```c++
bool Foo::Bar() {
NanScope();
Local<Boolean> val = NanFalse();
...
return val->Value();
}
```
<a name="api_nan_escapable_scope"></a>
### NanEscapableScope()
The separation of handle scopes into escapable and inescapable scopes makes `NanEscapableScope()` necessary, use it in place of `HandleScope scope` when you later wish to `Close()` the scope:
The separation of handle scopes into escapable and inescapable scopes makes `NanEscapableScope()` necessary, use it in place of `HandleScope scope` when you later wish to return a handle (`Handle` or `Local`) from the scope, this is for internal functions not directly exposed to V8:

@@ -586,3 +607,3 @@ ```c++

...
Local<Object> wrapper = NanPersistentToLocal(dataWrapperCtor)->NewInstance();
Local<Object> wrapper = NanNew(dataWrapperCtor)->NewInstance();
NanSetInternalFieldPointer(wrapper, 0, this);

@@ -597,14 +618,15 @@ ```

```c++
NanObjectWrapHandle(iterator)->Get(NanSymbol("end"))
NanObjectWrapHandle(iterator)->Get(NanNew<String>("end"))
```
<a name="api_nan_symbol"></a>
### String NanSymbol(char *)
### <del>Local&lt;String&gt; NanSymbol(const char *)</del>
Use to create string symbol objects (i.e. `v8::String::NewSymbol(x)`), for getting and setting object properties, or names of objects.
Deprecated. Use `NanNew<String>` instead.
<del>Use to create string symbol objects (i.e. `v8::String::NewSymbol(x)`), for getting and setting object properties, or names of objects.</del>
```c++
bool foo = false;
if (obj->Has(NanSymbol("foo")))
foo = optionsObj->Get(NanSymbol("foo"))->BooleanValue()
if (obj->Has(NanNew<String>("foo")))
foo = optionsObj->Get(NanNew<String>("foo"))->BooleanValue()
```

@@ -678,5 +700,5 @@

// `foo` is false unless the user supplies a truthy value for it
bool foo = NanBooleanOptionValue(optionsObj, NanSymbol("foo"));
bool foo = NanBooleanOptionValue(optionsObj, NanNew<String>("foo"));
// `bar` is true unless the user supplies a falsy value for it
bool bar = NanBooleanOptionValueDefTrue(optionsObj, NanSymbol("bar"), true);
bool bar = NanBooleanOptionValueDefTrue(optionsObj, NanNew<String>("bar"), true);
```

@@ -692,3 +714,3 @@

```c++
uint32_t count = NanUInt32OptionValue(optionsObj, NanSymbol("count"), 1024);
uint32_t count = NanUInt32OptionValue(optionsObj, NanNew<String>("count"), 1024);
```

@@ -708,6 +730,6 @@

For throwing `Error`, `TypeError` and `RangeError` objects. You should `return` this call:
For throwing `Error`, `TypeError` and `RangeError` objects.
```c++
return NanThrowError("you must supply a callback argument");
NanThrowError("you must supply a callback argument");
```

@@ -758,3 +780,3 @@

<a href="#api_nan_get_current_context">
### Local<Context> NanGetCurrentContext()
### Local&lt;Context&gt; NanGetCurrentContext()

@@ -777,3 +799,3 @@ Gets the current context.

<a name="api_nan_assign_persistent"></a>
### NanAssignPersistent(type, handle, object)
### NanAssignPersistent(handle, object)

@@ -790,8 +812,8 @@ Use `NanAssignPersistent` to assign a non-`Persistent` handle to a `Persistent` one. You can no longer just declare a `Persistent` handle and assign directly to it later, you have to `Reset` it in Node 0.11, so this makes it easier.

Local<Object> obj = NanNew<Object>();
obj->Set(NanSymbol("key"), keyHandle); // where keyHandle might be a Local<String>
NanAssignPersistent(Object, persistentHandle, obj)
obj->Set(NanNew<String>("key"), keyHandle); // where keyHandle might be a Local<String>
NanAssignPersistent(persistentHandle, obj)
```
<a name="api_nan_make_weak_persistent"></a>
### NanMakeWeakPersistent(Handle&lt;T&gt; handle, P* parameter, _NanWeakCallbackInfo&lt;T, P&gt;::Callback callback)
### _NanWeakCallbackInfo&lt;T, P&gt;* NanMakeWeakPersistent(Handle&lt;T&gt;, P*, _NanWeakCallbackInfo&lt;T, P&gt;::Callback)

@@ -900,3 +922,3 @@ Creates a weak persistent handle with the supplied parameter and `NAN_WEAK_CALLBACK`. The callback has to be fully specialized to work on all versions of Node.

`void SetFunction(Handle<Function>)` for setting the callback on the
`NanCallback`. Additionally a generic constructor is available for using
`NanCallback`. You can check if a `NanCallback` is empty with the `bool IsEmpty()` method. Additionally a generic constructor is available for using
`NanCallback` without performing heap allocations.

@@ -919,3 +941,3 @@

// Check the `char *errmsg` property and call HandleOKCallback()
// Check the `ErrorMessage()` and call HandleOKCallback()
// or HandleErrorCallback depending on whether it has been set or not

@@ -925,3 +947,3 @@ virtual void WorkComplete ();

// You must implement this to do some async work. If there is an
// error then allocate `errmsg` to a message and the callback will
// error then use `SetErrorMessage()` to set an error message and the callback will
// be passed that string in an Error object

@@ -931,11 +953,14 @@ virtual void Execute ();

// Save a V8 object in a Persistent handle to protect it from GC
void SavePersistent(const char *key, Local<Object> &obj);
void SaveToPersistent(const char *key, Local<Object> &obj);
// Fetch a stored V8 object (don't call from within `Execute()`)
Local<Object> GetFromPersistent(const char *key);
// Get the error message (or NULL)
const char *ErrorMessage();
// Set an error message
void SetErrorMessage(const char *msg);
protected:
// Set this if there is an error, otherwise it's NULL
const char *errmsg;
// Default implementation calls the callback function with no arguments.

@@ -962,3 +987,3 @@ // Override this to return meaningful data

<tr><th align="left">Rod Vagg</th><td><a href="https://github.com/rvagg">GitHub/rvagg</a></td><td><a href="http://twitter.com/rvagg">Twitter/@rvagg</a></td></tr>
<tr><th align="left">Benjamin Byholm</th><td><a href="https://github.com/kkoopa/">GitHub/kkoopa</a></td></tr>
<tr><th align="left">Benjamin Byholm</th><td><a href="https://github.com/kkoopa/">GitHub/kkoopa</a></td><td>-</td></tr>
<tr><th align="left">Trevor Norris</th><td><a href="https://github.com/trevnorris">GitHub/trevnorris</a></td><td><a href="http://twitter.com/trevnorris">Twitter/@trevnorris</a></td></tr>

@@ -965,0 +990,0 @@ <tr><th align="left">Nathan Rajlich</th><td><a href="https://github.com/TooTallNate">GitHub/TooTallNate</a></td><td><a href="http://twitter.com/TooTallNate">Twitter/@TooTallNate</a></td></tr>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc