Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deprecated v8::Handle to upgrade to node@12 #23

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
"test": "mocha"
},
"dependencies": {
"bindings": "^1.4.0",
"nan": "^2.12.1"
"bindings": "^1.5.0",
"nan": "^2.14.0"
},
"devDependencies": {
"mocha": "^6.0.0",
"mocha": "^6.1.4",
"should": "^13.2.3",
"sinon": "^7.2.4"
"sinon": "^7.3.2"
},
"gypfile": true
}
2 changes: 1 addition & 1 deletion src/addon.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "pcsclite.h"
#include "cardreader.h"

void init_all(v8::Handle<v8::Object> target) {
void init_all(v8::Local<v8::Object> target) {
PCSCLite::init(target);
CardReader::init(target);
}
Expand Down
10 changes: 5 additions & 5 deletions src/cardreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using namespace node;

Nan::Persistent<Function> CardReader::constructor;

void CardReader::init(Handle<Object> target) {
void CardReader::init(v8::Local<v8::Object> target) {

// Prepare constructor template
Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(New);
Expand Down Expand Up @@ -88,7 +88,7 @@ NAN_METHOD(CardReader::New) {

Nan::HandleScope scope;

v8::String::Utf8Value reader_name(info[0]->ToString());
Nan::Utf8String reader_name(Nan::New(info[0]).ToLocalChecked());
CardReader* obj = new CardReader(*reader_name);
obj->Wrap(info.Holder());
obj->handle()->Set(Nan::New(name_symbol), info[0]->ToString());
Expand Down Expand Up @@ -134,8 +134,8 @@ NAN_METHOD(CardReader::Connect) {
}

ConnectInput* ci = new ConnectInput();
ci->share_mode = info[0]->Uint32Value();
ci->pref_protocol = info[1]->Uint32Value();
ci->share_mode = info[0]->Uint32Value(context).FromJust();
ci->pref_protocol = info[1]->Uint32Value(context).FromJust();
Local<Function> cb = Local<Function>::Cast(info[2]);

// This creates our work request, including the libuv struct.
Expand Down Expand Up @@ -215,7 +215,7 @@ NAN_METHOD(CardReader::Transmit) {
return Nan::ThrowError("Fourth argument must be a callback function");
}

Local<Object> buffer_data = info[0]->ToObject();
Local<Object> buffer_data = Nan::New(info[0]).ToLocalChecked();
uint32_t out_len = info[1]->Uint32Value();
uint32_t protocol = info[2]->Uint32Value();
Local<Function> cb = Local<Function>::Cast(info[3]);
Expand Down
4 changes: 2 additions & 2 deletions src/cardreader.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class CardReader: public Nan::ObjectWrap {

public:

static void init(v8::Handle<v8::Object> target);
static void init(v8::Local<v8::Object> target);

const SCARDHANDLE& GetHandler() const { return m_card_handle; };

Expand Down Expand Up @@ -120,7 +120,7 @@ class CardReader: public Nan::ObjectWrap {
static void AfterTransmit(uv_work_t* req, int status);
static void AfterControl(uv_work_t* req, int status);

static v8::Handle<v8::Value> CreateBufferInstance(char* data, unsigned long size);
static v8::Local<v8::Value> CreateBufferInstance(char* data, unsigned long size);

private:

Expand Down
8 changes: 4 additions & 4 deletions src/pcsclite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using namespace node;

Nan::Persistent<Function> PCSCLite::constructor;

void PCSCLite::init(Handle<Object> target) {
void PCSCLite::init(Local<Object> target) {

// Prepare constructor template
Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(New);
Expand All @@ -15,9 +15,9 @@ void PCSCLite::init(Handle<Object> target) {
// Prototype
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());
Local<Context> context = Nan::GetCurrentContext();
constructor.Reset(tpl->GetFunction(context).ToLocalChecked());
target->Set(Nan::New("PCSCLite").ToLocalChecked(), tpl->GetFunction(context).ToLocalChecked());
}

PCSCLite::PCSCLite(): m_card_context(0),
Expand Down
2 changes: 1 addition & 1 deletion src/pcsclite.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PCSCLite: public Nan::ObjectWrap {

public:

static void init(v8::Handle<v8::Object> target);
static void init(v8::Local<v8::Object> target);

private:

Expand Down
Loading