summaryrefslogtreecommitdiff
path: root/platform/node
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-04-02 14:11:37 +0200
committerKonstantin Käfer <mail@kkaefer.com>2019-05-28 16:11:05 +0200
commit7f9274035bad30980e03574c315904ab7a85fe83 (patch)
tree7b9cd0f2e2883d6da22611eaa68fae07bb7245b6 /platform/node
parent33ee7e23de24bd3c076eafef819029cf45451d23 (diff)
downloadqtlocation-mapboxgl-7f9274035bad30980e03574c315904ab7a85fe83.tar.gz
[core] refactor program object creation
Diffstat (limited to 'platform/node')
-rw-r--r--platform/node/src/node_mapbox_gl_native.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/platform/node/src/node_mapbox_gl_native.cpp b/platform/node/src/node_mapbox_gl_native.cpp
index 96e96e4298..9b4437b0aa 100644
--- a/platform/node/src/node_mapbox_gl_native.cpp
+++ b/platform/node/src/node_mapbox_gl_native.cpp
@@ -6,12 +6,23 @@
#pragma GCC diagnostic pop
#include <mbgl/util/run_loop.hpp>
+#include <mbgl/gfx/backend.hpp>
#include "node_map.hpp"
#include "node_logging.hpp"
#include "node_request.hpp"
#include "node_expression.hpp"
+
+void SetBackendType(const Nan::FunctionCallbackInfo<v8::Value>& info) {
+ if (info.Length() < 1 || info[0]->IsUndefined()) {
+ return Nan::ThrowTypeError("Requires a render backend name");
+ }
+
+ const std::string backendName { *Nan::Utf8String(info[0]) };
+ (void)backendName;
+}
+
void RegisterModule(v8::Local<v8::Object> target, v8::Local<v8::Object> module) {
// This has the effect of:
// a) Ensuring that the static local variable is initialized before any thread contention.
@@ -19,6 +30,8 @@ void RegisterModule(v8::Local<v8::Object> target, v8::Local<v8::Object> module)
static mbgl::util::RunLoop nodeRunLoop;
nodeRunLoop.stop();
+ Nan::SetMethod(target, "setBackendType", SetBackendType);
+
node_mbgl::NodeMap::Init(target);
node_mbgl::NodeRequest::Init();
node_mbgl::NodeExpression::Init(target);