Skip to content

Commit

Permalink
jones-ndb: fix for more deprecation warnings; issue #41
Browse files Browse the repository at this point in the history
  • Loading branch information
jdduncan committed Dec 2, 2016
1 parent eadaca8 commit c18ec98
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions jones-ndb/impl/include/common/js_wrapper_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
02110-1301 USA
*/

#include <node.h>

#define STRING(I, S) v8::String::NewFromUtf8(I, S)

#define NEW_STRING(S) STRING(v8::Isolate::GetCurrent(), S)
Expand Down Expand Up @@ -81,10 +83,18 @@
#define DEFINE_JS_ACCESSOR(TARGET, property, getter) \
(TARGET)->SetAccessor(NEW_SYMBOL(property), getter)

/* Some compatibility */
#if NODE_MAJOR_VERSION > 3
#define DEFINE_JS_INT(TARGET, name, value) \
(TARGET)->CreateDataProperty((TARGET)->CreationContext(), \
NEW_SYMBOL(name), \
Integer::New(v8::Isolate::GetCurrent(), value))
#else
#define DEFINE_JS_INT(TARGET, name, value) \
(TARGET)->ForceSet(NEW_SYMBOL(name), \
Integer::New(v8::Isolate::GetCurrent(), value), \
static_cast<PropertyAttribute>(ReadOnly|DontDelete))
#endif

#define DEFINE_JS_CONSTANT(TARGET, constant) \
DEFINE_JS_INT(TARGET, #constant, constant)
Expand Down

0 comments on commit c18ec98

Please sign in to comment.