diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-04-02 14:11:37 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2019-05-28 16:11:05 +0200 |
commit | 7f9274035bad30980e03574c315904ab7a85fe83 (patch) | |
tree | 7b9cd0f2e2883d6da22611eaa68fae07bb7245b6 /platform/node/src | |
parent | 33ee7e23de24bd3c076eafef819029cf45451d23 (diff) | |
download | qtlocation-mapboxgl-7f9274035bad30980e03574c315904ab7a85fe83.tar.gz |
[core] refactor program object creation
Diffstat (limited to 'platform/node/src')
-rw-r--r-- | platform/node/src/node_mapbox_gl_native.cpp | 13 |
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); |