MCPcopy Create free account
hub / github.com/NodeRT/NodeRT / CreateArrayWrapper

Method CreateArrayWrapper

src/NodeRTLib/ProjectFiles/CollectionsWrap.h:63–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61 }
62
63 static Local<Value> CreateArrayWrapper(
64 ::Platform::Array<T> ^ winRtInstance,
65 const std::function<Local<Value>(T)>& getterFunc = nullptr,
66 const std::function<bool(Local<Value>)>& checkTypeFunc = nullptr,
67 const std::function<T(Local<Value>)>& convertToTypeFunc = nullptr) {
68 EscapableHandleScope scope;
69 if (winRtInstance == nullptr) {
70 return scope.Escape(Undefined());
71 }
72
73 if (s_constructorTemplate.IsEmpty()) {
74 Init();
75 }
76
77 v8::Local<Value> args[] = {Undefined()};
78 Local<FunctionTemplate> localRef =
79 Nan::New<FunctionTemplate>(s_constructorTemplate);
80 Local<Object> objectInstance =
81 Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), 0, args)
82 .ToLocalChecked();
83 if (objectInstance.IsEmpty()) {
84 return scope.Escape(Undefined());
85 }
86
87 ArrayWrapper<T>* wrapperInstance = new ArrayWrapper<T>(
88 winRtInstance, getterFunc, checkTypeFunc, convertToTypeFunc);
89 wrapperInstance->Wrap(objectInstance);
90 return scope.Escape(objectInstance);
91 }
92
93 virtual ::Platform::Object ^ GetObjectInstance() const override {
94 return _instance;

Callers

nothing calls this directly

Calls 1

InitFunction · 0.85

Tested by

no test coverage detected