8 #ifndef META_OCEAN_INTERACTION_JS_OBJECT_H
9 #define META_OCEAN_INTERACTION_JS_OBJECT_H
29 template <
typename T,
typename TNative>
59 static inline v8::Local<v8::Value>
create(
NativeType&& value,
const v8::Local<v8::Context>& context);
75 template <
typename T,
typename TNative>
78 template <
typename T,
typename TNative>
81 template <
typename T,
typename TNative>
84 if (functionTemplate_.IsEmpty())
86 T::createFunctionTemplate();
89 ocean_assert(!functionTemplate_.IsEmpty());
91 return functionTemplate_.Get(v8::Isolate::GetCurrent());
94 template <
typename T,
typename TNative>
97 ocean_assert(!objectTemplate_.IsEmpty());
98 return objectTemplate_.Get(v8::Isolate::GetCurrent());
101 template <
typename T,
typename TNative>
104 return createObject<T>(std::move(value), context);
107 template <
typename T,
typename TNative>
110 ocean_assert(!functionTemplate_.IsEmpty());
111 functionTemplate_.Reset();
113 ocean_assert(!objectTemplate_.IsEmpty());
114 objectTemplate_.Reset();
This class implements the base class for all JavaScript wrappers.
Definition: JSBase.h:34
This class implements the base class for all native wrapper of JavaScript objects.
Definition: JSObject.h:31
static v8::Persistent< v8::FunctionTemplate > functionTemplate_
Function template for the Vector2 object.
Definition: JSObject.h:69
static void release()
Releases the function and object template for this object.
Definition: JSObject.h:108
static v8::Local< v8::FunctionTemplate > functionTemplate()
Returns the function template for this object.
Definition: JSObject.h:82
static v8::Local< v8::Value > create(NativeType &&value, const v8::Local< v8::Context > &context)
Creates an new wrapped object.
Definition: JSObject.h:102
static v8::Local< v8::ObjectTemplate > objectTemplate()
Returns the object template for this object.
Definition: JSObject.h:95
static v8::Persistent< v8::ObjectTemplate > objectTemplate_
Object template for the Vector2 object.
Definition: JSObject.h:72
TNative NativeType
Definition of the native data type which is wrapped by this Java Script object.
Definition: JSObject.h:37
This template class implements a object reference with an internal reference counter.
Definition: base/ObjectRef.h:58
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15