How to return a new object from NanAsyncWorker?
问题 I'm working on a node.js/io.js native plugin, and I need to create a new native object from an async callback. Using the nan helpers, I've got something that looks like: class MyObject : public node::ObjectWrap { /* definition */ }; class MyWorker : public NanAsyncWorker { bool varForMyObject; virtual void Execute() {/* do stuff and sets varForMyObject */} virtual void HandleOKCallback() { NanScope(); MyObject* obj = new MyObject(varForMyObject); Local<Value> argv[] = { NanNull(), obj // ???