[node] NodeRequest inherits from Nan::AsyncWorker
drop NodeRequest::Create, move MakeCallback to NodeRequest::Execute rework Respond -> HandleCallback modern NAN style updates
This commit is contained in:
@@ -11,29 +11,31 @@
|
||||
|
||||
namespace node_mbgl {
|
||||
|
||||
class NodeFileSource;
|
||||
class NodeRequest;
|
||||
class NodeMap;
|
||||
|
||||
class NodeRequest : public Nan::ObjectWrap {
|
||||
class NodeRequest : public Nan::ObjectWrap,
|
||||
public Nan::AsyncWorker {
|
||||
public:
|
||||
static NAN_MODULE_INIT(Init);
|
||||
|
||||
static NAN_METHOD(New);
|
||||
static NAN_METHOD(Respond);
|
||||
|
||||
static v8::Handle<v8::Object> Create(const mbgl::Resource&, mbgl::FileSource::Callback);
|
||||
static Nan::Persistent<v8::Function> constructor;
|
||||
|
||||
NodeRequest(mbgl::FileSource::Callback);
|
||||
~NodeRequest();
|
||||
|
||||
struct NodeAsyncRequest : public mbgl::AsyncRequest {
|
||||
NodeAsyncRequest(NodeRequest*);
|
||||
~NodeAsyncRequest() override;
|
||||
NodeRequest* request;
|
||||
};
|
||||
|
||||
NodeRequest(NodeMap*, mbgl::FileSource::Callback);
|
||||
~NodeRequest();
|
||||
|
||||
static Nan::Persistent<v8::Function> constructor;
|
||||
|
||||
static NAN_MODULE_INIT(Init);
|
||||
|
||||
static void New(const Nan::FunctionCallbackInfo<v8::Value>&);
|
||||
static void HandleCallback(const Nan::FunctionCallbackInfo<v8::Value>&);
|
||||
|
||||
void Execute();
|
||||
|
||||
private:
|
||||
NodeMap* target;
|
||||
mbgl::FileSource::Callback callback;
|
||||
NodeAsyncRequest* asyncRequest = nullptr;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user