combine other classes
This commit is contained in:
parent
e76cb3b905
commit
6af98acd11
|
@ -94,7 +94,7 @@ void ListClass<T>::get_index(ContextType ctx, ObjectType object, uint32_t index,
|
|||
auto list = get_internal<T, ListClass<T>>(object);
|
||||
auto realm_object = realm::Object(list->get_realm(), list->get_object_schema(), list->get(index));
|
||||
|
||||
return_value.set(RealmObject<T>::create_instance(ctx, realm_object));
|
||||
return_value.set(RealmObjectClass<T>::create_instance(ctx, realm_object));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@ -130,7 +130,7 @@ void ListClass<T>::pop(ContextType ctx, ObjectType this_object, size_t argc, con
|
|||
size_t index = size - 1;
|
||||
auto realm_object = realm::Object(list->get_realm(), list->get_object_schema(), list->get(index));
|
||||
|
||||
return_value.set(RealmObject<T>::create_instance(ctx, realm_object));
|
||||
return_value.set(RealmObjectClass<T>::create_instance(ctx, realm_object));
|
||||
list->remove(index);
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ void ListClass<T>::shift(ContextType ctx, ObjectType this_object, size_t argc, c
|
|||
else {
|
||||
auto realm_object = realm::Object(list->get_realm(), list->get_object_schema(), list->get(0));
|
||||
|
||||
return_value.set(RealmObject<T>::create_instance(ctx, realm_object));
|
||||
return_value.set(RealmObjectClass<T>::create_instance(ctx, realm_object));
|
||||
list->remove(0);
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ void ListClass<T>::splice(ContextType ctx, ObjectType this_object, size_t argc,
|
|||
for (size_t i = 0; i < remove; i++) {
|
||||
auto realm_object = realm::Object(list->get_realm(), list->get_object_schema(), list->get(index));
|
||||
|
||||
removed_objects.push_back(RealmObject<T>::create_instance(ctx, realm_object));
|
||||
removed_objects.push_back(RealmObjectClass<T>::create_instance(ctx, realm_object));
|
||||
list->remove(index);
|
||||
}
|
||||
for (size_t i = 2; i < argc; i++) {
|
||||
|
|
|
@ -125,7 +125,7 @@ struct NativeAccessor {
|
|||
throw std::runtime_error("object is not a Realm Object");
|
||||
}
|
||||
static ValueType from_object(ContextType ctx, realm::Object realm_object) {
|
||||
return RealmObject<T>::create_instance(ctx, realm_object);
|
||||
return RealmObjectClass<T>::create_instance(ctx, realm_object);
|
||||
}
|
||||
|
||||
static size_t list_size(ContextType ctx, ValueType &value) {
|
||||
|
|
117
src/js_realm.hpp
117
src/js_realm.hpp
|
@ -116,7 +116,7 @@ class RealmDelegate : public BindingContext {
|
|||
}
|
||||
}
|
||||
|
||||
friend class Realm<T>;
|
||||
friend class RealmClass<T>;
|
||||
};
|
||||
|
||||
std::string default_path();
|
||||
|
@ -124,7 +124,8 @@ void set_default_path(std::string path);
|
|||
void delete_all_realms();
|
||||
|
||||
template<typename T>
|
||||
class Realm {
|
||||
class RealmClass : public ClassDefinition<T, SharedRealm> {
|
||||
public:
|
||||
using GlobalContextType = typename T::GlobalContext;
|
||||
using ContextType = typename T::Context;
|
||||
using FunctionType = typename T::Function;
|
||||
|
@ -136,7 +137,6 @@ class Realm {
|
|||
using ReturnValue = js::ReturnValue<T>;
|
||||
using NativeAccessor = realm::NativeAccessor<ValueType, ContextType>;
|
||||
|
||||
public:
|
||||
static FunctionType create_constructor(ContextType);
|
||||
|
||||
// methods
|
||||
|
@ -166,6 +166,37 @@ class Realm {
|
|||
static void get_default_path(ContextType, ObjectType, ReturnValue &);
|
||||
static void set_default_path(ContextType, ObjectType, ValueType value);
|
||||
|
||||
std::string const name = "Realm";
|
||||
|
||||
MethodMap<T> const static_methods = {
|
||||
{"schemaVersion", wrap<schema_version>},
|
||||
{"clearTestState", wrap<clear_test_state>},
|
||||
{"copyBundledRealmFiles", wrap<copy_bundled_realm_files>},
|
||||
};
|
||||
|
||||
PropertyMap<T> const static_properties = {
|
||||
{"defaultPath", {wrap<get_default_path>, wrap<set_default_path>}},
|
||||
};
|
||||
|
||||
MethodMap<T> const methods = {
|
||||
{"objects", wrap<objects>},
|
||||
{"create", wrap<create>},
|
||||
{"delete", wrap<delete_one>},
|
||||
{"deleteAll", wrap<delete_all>},
|
||||
{"write", wrap<write>},
|
||||
{"addListener", wrap<add_listener>},
|
||||
{"removeListener", wrap<remove_listener>},
|
||||
{"removeAllListeners", wrap<remove_all_listeners>},
|
||||
{"close", wrap<close>},
|
||||
};
|
||||
|
||||
PropertyMap<T> const properties = {
|
||||
{"path", {wrap<get_path>, nullptr}},
|
||||
{"schemaVersion", {wrap<get_schema_version>, nullptr}},
|
||||
{"schema", {wrap<get_schema>, nullptr}},
|
||||
{"readOnly", {wrap<get_read_only>, nullptr}},
|
||||
};
|
||||
|
||||
private:
|
||||
static std::string validated_notification_name(ContextType ctx, const ValueType &value) {
|
||||
std::string name = Value::validated_to_string(ctx, value, "notification name");
|
||||
|
@ -200,45 +231,7 @@ class Realm {
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
struct RealmClass : ClassDefinition<T, SharedRealm> {
|
||||
using Realm = js::Realm<T>;
|
||||
|
||||
std::string const name = "Realm";
|
||||
|
||||
ConstructorType<T>* const constructor = Realm::constructor;
|
||||
|
||||
MethodMap<T> const static_methods = {
|
||||
{"schemaVersion", wrap<Realm::schema_version>},
|
||||
{"clearTestState", wrap<Realm::clear_test_state>},
|
||||
{"copyBundledRealmFiles", wrap<Realm::copy_bundled_realm_files>},
|
||||
};
|
||||
|
||||
PropertyMap<T> const static_properties = {
|
||||
{"defaultPath", {wrap<Realm::get_default_path>, wrap<Realm::set_default_path>}},
|
||||
};
|
||||
|
||||
MethodMap<T> const methods = {
|
||||
{"objects", wrap<Realm::objects>},
|
||||
{"create", wrap<Realm::create>},
|
||||
{"delete", wrap<Realm::delete_one>},
|
||||
{"deleteAll", wrap<Realm::delete_all>},
|
||||
{"write", wrap<Realm::write>},
|
||||
{"addListener", wrap<Realm::add_listener>},
|
||||
{"removeListener", wrap<Realm::remove_listener>},
|
||||
{"removeAllListeners", wrap<Realm::remove_all_listeners>},
|
||||
{"close", wrap<Realm::close>},
|
||||
};
|
||||
|
||||
PropertyMap<T> const properties = {
|
||||
{"path", {wrap<Realm::get_path>, nullptr}},
|
||||
{"schemaVersion", {wrap<Realm::get_schema_version>, nullptr}},
|
||||
{"schema", {wrap<Realm::get_schema>, nullptr}},
|
||||
{"readOnly", {wrap<Realm::get_read_only>, nullptr}},
|
||||
};
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline typename T::Function Realm<T>::create_constructor(ContextType ctx) {
|
||||
inline typename T::Function RealmClass<T>::create_constructor(ContextType ctx) {
|
||||
FunctionType realm_constructor = ObjectWrap<T, RealmClass<T>>::create_constructor(ctx);
|
||||
FunctionType collection_constructor = ObjectWrap<T, CollectionClass<T>>::create_constructor(ctx);
|
||||
FunctionType list_constructor = ObjectWrap<T, ListClass<T>>::create_constructor(ctx);
|
||||
|
@ -280,7 +273,7 @@ static void convert_outdated_datetime_columns(const SharedRealm &realm) {
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::constructor(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[]) {
|
||||
void RealmClass<T>::constructor(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[]) {
|
||||
realm::Realm::Config config;
|
||||
typename Schema<T>::ObjectDefaultsMap defaults;
|
||||
typename Schema<T>::ConstructorMap constructors;
|
||||
|
@ -396,7 +389,7 @@ void Realm<T>::constructor(ContextType ctx, ObjectType this_object, size_t argc,
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::schema_version(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
void RealmClass<T>::schema_version(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
validate_argument_count(argc, 1, 2);
|
||||
|
||||
realm::Realm::Config config;
|
||||
|
@ -417,52 +410,52 @@ void Realm<T>::schema_version(ContextType ctx, ObjectType this_object, size_t ar
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::clear_test_state(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
void RealmClass<T>::clear_test_state(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
validate_argument_count(argc, 0);
|
||||
delete_all_realms();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::copy_bundled_realm_files(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
void RealmClass<T>::copy_bundled_realm_files(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
validate_argument_count(argc, 0);
|
||||
realm::copy_bundled_realm_files();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::get_default_path(ContextType ctx, ObjectType object, ReturnValue &return_value) {
|
||||
void RealmClass<T>::get_default_path(ContextType ctx, ObjectType object, ReturnValue &return_value) {
|
||||
return_value.set(realm::js::default_path());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::set_default_path(ContextType ctx, ObjectType object, ValueType value) {
|
||||
void RealmClass<T>::set_default_path(ContextType ctx, ObjectType object, ValueType value) {
|
||||
js::set_default_path(Value::validated_to_string(ctx, value, "defaultPath"));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::get_path(ContextType ctx, ObjectType object, ReturnValue &return_value) {
|
||||
void RealmClass<T>::get_path(ContextType ctx, ObjectType object, ReturnValue &return_value) {
|
||||
std::string path = get_internal<T, RealmClass<T>>(object)->get()->config().path;
|
||||
return_value.set(path);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::get_schema_version(ContextType ctx, ObjectType object, ReturnValue &return_value) {
|
||||
void RealmClass<T>::get_schema_version(ContextType ctx, ObjectType object, ReturnValue &return_value) {
|
||||
double version = get_internal<T, RealmClass<T>>(object)->get()->config().schema_version;
|
||||
return_value.set(version);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::get_schema(ContextType ctx, ObjectType object, ReturnValue &return_value) {
|
||||
void RealmClass<T>::get_schema(ContextType ctx, ObjectType object, ReturnValue &return_value) {
|
||||
auto schema = get_internal<T, RealmClass<T>>(object)->get()->config().schema.get();
|
||||
return_value.set(Schema<T>::object_for_schema(ctx, *schema));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::get_read_only(ContextType ctx, ObjectType object, ReturnValue &return_value) {
|
||||
void RealmClass<T>::get_read_only(ContextType ctx, ObjectType object, ReturnValue &return_value) {
|
||||
return_value.set(get_internal<T, RealmClass<T>>(object)->get()->config().read_only);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::objects(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
void RealmClass<T>::objects(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
validate_argument_count(argc, 1);
|
||||
|
||||
SharedRealm realm = *get_internal<T, RealmClass<T>>(this_object);
|
||||
|
@ -472,7 +465,7 @@ void Realm<T>::objects(ContextType ctx, ObjectType this_object, size_t argc, con
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::create(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
void RealmClass<T>::create(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
validate_argument_count(argc, 2, 3);
|
||||
|
||||
SharedRealm realm = *get_internal<T, RealmClass<T>>(this_object);
|
||||
|
@ -495,11 +488,11 @@ void Realm<T>::create(ContextType ctx, ObjectType this_object, size_t argc, cons
|
|||
}
|
||||
|
||||
auto realm_object = realm::Object::create<ValueType>(ctx, realm, *object_schema, object, update);
|
||||
return_value.set(RealmObject<T>::create_instance(ctx, realm_object));
|
||||
return_value.set(RealmObjectClass<T>::create_instance(ctx, realm_object));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::delete_one(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
void RealmClass<T>::delete_one(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
validate_argument_count(argc, 1);
|
||||
|
||||
SharedRealm realm = *get_internal<T, RealmClass<T>>(this_object);
|
||||
|
@ -542,7 +535,7 @@ void Realm<T>::delete_one(ContextType ctx, ObjectType this_object, size_t argc,
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::delete_all(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
void RealmClass<T>::delete_all(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
validate_argument_count(argc, 0);
|
||||
|
||||
SharedRealm realm = *get_internal<T, RealmClass<T>>(this_object);
|
||||
|
@ -557,7 +550,7 @@ void Realm<T>::delete_all(ContextType ctx, ObjectType this_object, size_t argc,
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::write(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
void RealmClass<T>::write(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
validate_argument_count(argc, 1);
|
||||
|
||||
SharedRealm realm = *get_internal<T, RealmClass<T>>(this_object);
|
||||
|
@ -577,7 +570,7 @@ void Realm<T>::write(ContextType ctx, ObjectType this_object, size_t argc, const
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::add_listener(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
void RealmClass<T>::add_listener(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
validate_argument_count(argc, 2);
|
||||
|
||||
validated_notification_name(ctx, arguments[0]);
|
||||
|
@ -588,7 +581,7 @@ void Realm<T>::add_listener(ContextType ctx, ObjectType this_object, size_t argc
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::remove_listener(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
void RealmClass<T>::remove_listener(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
validate_argument_count(argc, 2);
|
||||
|
||||
validated_notification_name(ctx, arguments[0]);
|
||||
|
@ -599,7 +592,7 @@ void Realm<T>::remove_listener(ContextType ctx, ObjectType this_object, size_t a
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::remove_all_listeners(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
void RealmClass<T>::remove_all_listeners(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
validate_argument_count(argc, 0, 1);
|
||||
if (argc) {
|
||||
validated_notification_name(ctx, arguments[0]);
|
||||
|
@ -610,7 +603,7 @@ void Realm<T>::remove_all_listeners(ContextType ctx, ObjectType this_object, siz
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
void Realm<T>::close(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
void RealmClass<T>::close(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
validate_argument_count(argc, 0);
|
||||
|
||||
SharedRealm realm = *get_internal<T, RealmClass<T>>(this_object);
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace realm {
|
|||
namespace js {
|
||||
|
||||
template<typename T>
|
||||
class RealmObject {
|
||||
struct RealmObjectClass : ClassDefinition<T, realm::Object> {
|
||||
using ContextType = typename T::Context;
|
||||
using FunctionType = typename T::Function;
|
||||
using ObjectType = typename T::Object;
|
||||
|
@ -40,7 +40,6 @@ class RealmObject {
|
|||
using Function = js::Function<T>;
|
||||
using ReturnValue = js::ReturnValue<T>;
|
||||
|
||||
public:
|
||||
static ObjectType create_instance(ContextType, realm::Object &);
|
||||
|
||||
static void get_property(ContextType, ObjectType, const String &, ReturnValue &);
|
||||
|
@ -48,32 +47,27 @@ class RealmObject {
|
|||
static std::vector<String> get_property_names(ContextType, ObjectType);
|
||||
|
||||
static void is_valid(ContextType, ObjectType, size_t, const ValueType [], ReturnValue &);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct RealmObjectClass : ClassDefinition<T, realm::Object> {
|
||||
using RealmObject = js::RealmObject<T>;
|
||||
|
||||
const std::string name = "RealmObject";
|
||||
|
||||
const StringPropertyType<T> string_accessor = {
|
||||
wrap<RealmObject::get_property>,
|
||||
wrap<RealmObject::set_property>,
|
||||
wrap<RealmObject::get_property_names>,
|
||||
wrap<get_property>,
|
||||
wrap<set_property>,
|
||||
wrap<get_property_names>,
|
||||
};
|
||||
|
||||
MethodMap<T> const methods = {
|
||||
{"isValid", wrap<RealmObject::is_valid>},
|
||||
{"isValid", wrap<is_valid>},
|
||||
};
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
void RealmObject<T>::is_valid(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
void RealmObjectClass<T>::is_valid(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||
return_value.set(get_internal<T, RealmObjectClass<T>>(this_object)->is_valid());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename T::Object RealmObject<T>::create_instance(ContextType ctx, realm::Object &realm_object) {
|
||||
typename T::Object RealmObjectClass<T>::create_instance(ContextType ctx, realm::Object &realm_object) {
|
||||
static String prototype_string = "prototype";
|
||||
|
||||
auto delegate = get_delegate<T>(realm_object.realm().get());
|
||||
|
@ -97,7 +91,7 @@ typename T::Object RealmObject<T>::create_instance(ContextType ctx, realm::Objec
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
void RealmObject<T>::get_property(ContextType ctx, ObjectType object, const String &property, ReturnValue &return_value) {
|
||||
void RealmObjectClass<T>::get_property(ContextType ctx, ObjectType object, const String &property, ReturnValue &return_value) {
|
||||
try {
|
||||
auto realm_object = get_internal<T, RealmObjectClass<T>>(object);
|
||||
auto result = realm_object->template get_property_value<ValueType>(ctx, property);
|
||||
|
@ -108,7 +102,7 @@ void RealmObject<T>::get_property(ContextType ctx, ObjectType object, const Stri
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
bool RealmObject<T>::set_property(ContextType ctx, ObjectType object, const String &property, ValueType value) {
|
||||
bool RealmObjectClass<T>::set_property(ContextType ctx, ObjectType object, const String &property, ValueType value) {
|
||||
auto realm_object = get_internal<T, RealmObjectClass<T>>(object);
|
||||
try {
|
||||
realm_object->set_property_value(ctx, property, value, true);
|
||||
|
@ -120,7 +114,7 @@ bool RealmObject<T>::set_property(ContextType ctx, ObjectType object, const Stri
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
std::vector<String<T>> RealmObject<T>::get_property_names(ContextType ctx, ObjectType object) {
|
||||
std::vector<String<T>> RealmObjectClass<T>::get_property_names(ContextType ctx, ObjectType object) {
|
||||
auto realm_object = get_internal<T, RealmObjectClass<T>>(object);
|
||||
auto &properties = realm_object->get_object_schema().properties;
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ void ResultsClass<T>::get_index(ContextType ctx, ObjectType object, uint32_t ind
|
|||
}
|
||||
|
||||
auto realm_object = realm::Object(results->get_realm(), results->get_object_schema(), results->get(index));
|
||||
return_value.set(RealmObject<T>::create_instance(ctx, realm_object));
|
||||
return_value.set(RealmObjectClass<T>::create_instance(ctx, realm_object));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -28,7 +28,7 @@ using namespace realm;
|
|||
using namespace realm::jsc;
|
||||
|
||||
JSObjectRef RJSConstructorCreate(JSContextRef ctx) {
|
||||
return js::Realm<Types>::create_constructor(ctx);
|
||||
return js::RealmClass<Types>::create_constructor(ctx);
|
||||
}
|
||||
|
||||
void RJSInitializeInContext(JSContextRef ctx) {
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace node {
|
|||
|
||||
static void init(v8::Local<v8::Object> exports) {
|
||||
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
||||
v8::Local<v8::Function> realm_constructor = js::Realm<Types>::create_constructor(isolate);
|
||||
v8::Local<v8::Function> realm_constructor = js::RealmClass<Types>::create_constructor(isolate);
|
||||
|
||||
Nan::Set(exports, realm_constructor->GetName(), realm_constructor);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue