summaryrefslogtreecommitdiff
path: root/platform/node/src/node_mapbox_gl_native.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/node/src/node_mapbox_gl_native.cpp')
-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);