diff --git a/hoot-js/src/main/cpp/hoot/js/elements/WayJs.cpp b/hoot-js/src/main/cpp/hoot/js/elements/WayJs.cpp
index 165b84b..0c992bd 100644
--- a/hoot-js/src/main/cpp/hoot/js/elements/WayJs.cpp
+++ b/hoot-js/src/main/cpp/hoot/js/elements/WayJs.cpp
@@ -22,7 +22,7 @@
* This will properly maintain the copyright information. DigitalGlobe
* copyrights will be updated automatically.
*
- * @copyright Copyright (C) 2015, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
*/
#include "WayJs.h"
@@ -69,6 +69,8 @@ void WayJs::Init(Handle<Object> target)
tpl->InstanceTemplate()->SetInternalFieldCount(1);
// Prototype
ElementJs::_addBaseFunctions(tpl);
+ tpl->PrototypeTemplate()->Set(
+ String::NewFromUtf8(current, "getNodeCount"), FunctionTemplate::New(current, getNodeCount));
_constructor.Reset(current, tpl->GetFunction());
target->Set(String::NewFromUtf8(current, "Way"), ToLocal(&_constructor));
@@ -110,5 +112,13 @@ void WayJs::New(const FunctionCallbackInfo<Value>& args)
args.GetReturnValue().Set(args.This());
}
+void WayJs::getNodeCount(const FunctionCallbackInfo<Value>& args)
+{
+ Isolate* current = args.GetIsolate();
+ HandleScope scope(current);
+
+ ConstWayPtr way = ObjectWrap::Unwrap<WayJs>(args.This())->getConstWay();
+ args.GetReturnValue().Set(Number::New(current, way->getNodeCount()));
}
+}