#pragma once #include #include #include #include #include namespace node_mbgl { class NodeFileSource; class NodeMap : public node::ObjectWrap { struct RenderOptions; class RenderWorker; //////////////////////////////////////////////////////////////////////////////////////////////// // Static Node Methods public: static void Init(v8::Handle target); static NAN_METHOD(New); static NAN_METHOD(SetAccessToken); static NAN_METHOD(Load); static NAN_METHOD(Render); void startRender(std::unique_ptr options); void renderFinished(); static std::unique_ptr ParseOptions(v8::Local obj); static v8::Persistent constructorTemplate; //////////////////////////////////////////////////////////////////////////////////////////////// // Instance private: NodeMap(v8::Handle source); ~NodeMap(); private: // For retaining the FileSource object. v8::Persistent source; mbgl::HeadlessView view; NodeFileSource &fs; mbgl::Map map; std::unique_ptr image; std::unique_ptr callback; // Async for delivering the notifications of render completion. uv_async_t *async; }; }