From 923f1aa58b3e9a0382c139d352b877ef9c949e62 Mon Sep 17 00:00:00 2001 From: raub Date: Wed, 21 Mar 2018 11:25:49 +0300 Subject: [PATCH] minor fixes --- README.md | 2 +- include/event-emitter.hpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8a77eae..bdfdcfc 100644 --- a/README.md +++ b/README.md @@ -653,7 +653,7 @@ void Example::init(Handle target) { Local ctor = Nan::GetFunction(proto).ToLocalChecked(); - _prototype.Reset(proto); + _constructor.Reset(ctor); Nan::Set(target, JS_STR("Example"), ctor); diff --git a/include/event-emitter.hpp b/include/event-emitter.hpp index 44361ac..d3fa83c 100644 --- a/include/event-emitter.hpp +++ b/include/event-emitter.hpp @@ -16,12 +16,13 @@ if (eventEmitter->_isDestroyed) return; +// This template class provides static-member initialization in-header template -struct StaticHolder { +class StaticHolder { +protected: static Nan::Persistent _prototype; static Nan::Persistent _constructor; }; - template Nan::Persistent StaticHolder::_prototype; template Nan::Persistent StaticHolder::_constructor; @@ -36,9 +37,9 @@ class EventEmitter : public StaticHolder, public Nan::ObjectWrap { typedef MAP_TYPE::iterator MAP_IT_TYPE; typedef FNMAP_TYPE::iterator FNMAP_IT_TYPE; -// Public V8 init public: + // Public V8 init static void init(v8::Local target) { v8::Local proto = Nan::New(newCtor);