Commit e1191f5f by Marcin Cieslak

Use NAN_MODULE_INIT for exports, use Nan::HandleScope

No need to have EscapableHandleScope, since local
handle is not returned by the method - only
assigned to an objects supplied by the caller.
parent acd67bf4
...@@ -304,7 +304,7 @@ NAN_METHOD(libsass_version) { ...@@ -304,7 +304,7 @@ NAN_METHOD(libsass_version) {
info.GetReturnValue().Set(Nan::New<v8::String>(libsass_version()).ToLocalChecked()); info.GetReturnValue().Set(Nan::New<v8::String>(libsass_version()).ToLocalChecked());
} }
void RegisterModule(v8::Local<v8::Object> target) { NAN_MODULE_INIT(RegisterModule) {
Nan::SetMethod(target, "render", render); Nan::SetMethod(target, "render", render);
Nan::SetMethod(target, "renderSync", render_sync); Nan::SetMethod(target, "renderSync", render_sync);
Nan::SetMethod(target, "renderFile", render_file); Nan::SetMethod(target, "renderFile", render_file);
......
...@@ -43,8 +43,8 @@ namespace SassTypes ...@@ -43,8 +43,8 @@ namespace SassTypes
} }
} }
void Factory::initExports(v8::Local<v8::Object> exports) { NAN_MODULE_INIT(Factory::initExports) {
Nan::EscapableHandleScope scope; Nan::HandleScope scope;
v8::Local<v8::Object> types = Nan::New<v8::Object>(); v8::Local<v8::Object> types = Nan::New<v8::Object>();
Nan::Set(types, Nan::New("Number").ToLocalChecked(), Number::get_constructor()); Nan::Set(types, Nan::New("Number").ToLocalChecked(), Number::get_constructor());
...@@ -55,7 +55,7 @@ namespace SassTypes ...@@ -55,7 +55,7 @@ namespace SassTypes
Nan::Set(types, Nan::New("Map").ToLocalChecked(), Map::get_constructor()); Nan::Set(types, Nan::New("Map").ToLocalChecked(), Map::get_constructor());
Nan::Set(types, Nan::New("Null").ToLocalChecked(), Null::get_constructor()); Nan::Set(types, Nan::New("Null").ToLocalChecked(), Null::get_constructor());
Nan::Set(types, Nan::New("Error").ToLocalChecked(), Error::get_constructor()); Nan::Set(types, Nan::New("Error").ToLocalChecked(), Error::get_constructor());
Nan::Set(exports, Nan::New<v8::String>("types").ToLocalChecked(), scope.Escape(types)); Nan::Set(target, Nan::New<v8::String>("types").ToLocalChecked(), types);
} }
Value* Factory::unwrap(v8::Local<v8::Value> obj) { Value* Factory::unwrap(v8::Local<v8::Value> obj) {
......
...@@ -11,7 +11,7 @@ namespace SassTypes ...@@ -11,7 +11,7 @@ namespace SassTypes
// to wrap a given Sass_Value object. // to wrap a given Sass_Value object.
class Factory { class Factory {
public: public:
static void initExports(v8::Local<v8::Object>); static NAN_MODULE_INIT(initExports);
static Value* create(Sass_Value*); static Value* create(Sass_Value*);
static Value* unwrap(v8::Local<v8::Value>); static Value* unwrap(v8::Local<v8::Value>);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment