Node 12 fixes

This commit is contained in:
jimmythesaint82
2019-06-21 01:32:31 +02:00
parent de7ed0f4b4
commit 2ccd6e1693
5 changed files with 36 additions and 21 deletions

View File

@@ -6,7 +6,9 @@ using namespace node;
Nan::Persistent<Function> PCSCLite::constructor;
void PCSCLite::init(Handle<Object> target) {
void PCSCLite::init(Local<Object> target) {
Local<Context> context = Nan::GetCurrentContext();
// Prepare constructor template
Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(New);
@@ -16,8 +18,9 @@ void PCSCLite::init(Handle<Object> target) {
Nan::SetPrototypeTemplate(tpl, "start", Nan::New<FunctionTemplate>(Start));
Nan::SetPrototypeTemplate(tpl, "close", Nan::New<FunctionTemplate>(Close));
constructor.Reset(tpl->GetFunction());
target->Set(Nan::New("PCSCLite").ToLocalChecked(), tpl->GetFunction());
constructor.Reset(tpl->GetFunction(context).ToLocalChecked());
target->Set(Nan::New("PCSCLite").ToLocalChecked(), tpl->GetFunction(context).ToLocalChecked());
}
PCSCLite::PCSCLite(): m_card_context(0),