It's good practice now to call JS functions that don't execute in a
specific scope with v8::Null() as the receiver. Update the addons
documentation.
PR-URL: https://github.com/iojs/io.js/pull/1125
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Wholesale importing an entire namespace with `using namespace` is a bad
practice. Remove it from the addons documentation and replace it with
proper `using` directives. Wrap code in a namespace while we are here.
PR-URL: https://github.com/iojs/io.js/pull/1125
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
v8::Handle is on its way out, to be replaced with v8::Local. Update the
addons documentation accordingly.
PR-URL: https://github.com/iojs/io.js/pull/1125
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Remove unnecessary v8::HandleScope uses from the addons documentation.
C++ API callbacks run in an implicit v8::HandleScope, there is no need
to declare one in the callback function.
PR-URL: https://github.com/iojs/io.js/pull/1125
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
v8::Isolate::GetCurrent() is slated for deprecation. Replace its uses
in the addons documentation with v8::Object::GetIsolate(), etc.
PR-URL: https://github.com/iojs/io.js/pull/1125
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This prevents segfaults when a native method is reassigned to a
different object (which corrupts args.This()). When unwrapping,
clients should use args.Holder() instead of args.This().
Closes #6690.
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
V8 was upgraded from 3.22 to 3.24 in commit 1c7bf24. Upgrade source
files in test/addons/ and automatically generated tests from
doc/api/addons.markdown to the new V8 API.
This coincidentally fixes a bug in src/node_object_wrap.h where it was
still using the old V8 weak persistent handle interface, which is gone
in 3.24.
* Extend examples to show how to handle non-constructor invocation in
constructor callback functions.
* Fix up examples to initialize member variables at object construction.
* Fix up a few naming inconsistencies.
Fixes #5701.
mainly to allow native addons to export single functions on `exports`
rather than being restricted to operating on an existing `exports`
object.
added link to addons repo in docs