MakeCallback arguments?

34 views
Skip to first unread message

Nicolas P

unread,
Jun 20, 2014, 9:27:46 AM6/20/14
to nod...@googlegroups.com
Hi,

I'm making a Node.js add-on and I want a callback function like this:

var port = new addon.CANPort();
port.setCallback(function(msg) {
console.log(msg);
});
 
That will be useful because I will receive some datagrams, and I want my Node server to manage them.

But I can't find useful examples of people using MakeCallback function...

void CanObject::CANCallback(sCanMsg* msg)
{
Isolate* isolate = Isolate::GetCurrent();
HandleScope scope(isolate);

const int argc = 1;
Handle<Value> argv[argc] = { String::NewFromUtf8(isolate, "This is a test !") };
node::MakeCallback(isolate, I_DONT_KNOW, mCallback, argc, argv);
}

So mCallback is fixed with a mCallback.Reset(isolate, args[0].As<Function>());

but now, I don't know what to put in MakeCallback as second argument : Handle<Object> recv...

Thanks,
Nicolas.
Reply all
Reply to author
Forward
0 new messages