This commit is contained in:
Ari Lazier 2016-04-26 16:59:03 -07:00
parent 591dce8051
commit 27d973151f
6 changed files with 8 additions and 14 deletions

View File

@ -237,7 +237,7 @@ inline typename T::Function Realm<T>::create_constructor(ContextType ctx) {
Object::set_property(ctx, realm_constructor, "Collection", collection_constructor, attributes); Object::set_property(ctx, realm_constructor, "Collection", collection_constructor, attributes);
Object::set_property(ctx, realm_constructor, "List", list_constructor, attributes); Object::set_property(ctx, realm_constructor, "List", list_constructor, attributes);
Object::set_property(ctx, realm_constructor, "Results", results_constructor, attributes); Object::set_property(ctx, realm_constructor, "Results", results_constructor, attributes);
Object::set_property(ctx, realm_constructor, "RealmObject", realm_object_constructor, attributes); Object::set_property(ctx, realm_constructor, "Object", realm_object_constructor, attributes);
return realm_constructor; return realm_constructor;
} }

View File

@ -52,6 +52,10 @@ class RealmObject {
template<typename T> template<typename T>
struct RealmObjectClass : ClassDefinition<T, realm::Object> { struct RealmObjectClass : ClassDefinition<T, realm::Object> {
using ContextType = typename T::Context;
using ObjectType = typename T::Object;
using ValueType = typename T::Value;
using ReturnValue = js::ReturnValue<T>;
using RealmObject = js::RealmObject<T>; using RealmObject = js::RealmObject<T>;
const std::string name = "RealmObject"; const std::string name = "RealmObject";
@ -62,12 +66,6 @@ struct RealmObjectClass : ClassDefinition<T, realm::Object> {
wrap<RealmObject::get_property_names>, wrap<RealmObject::get_property_names>,
}; };
using ContextType = typename T::Context;
using ObjectType = typename T::Object;
using ValueType = typename T::Value;
using ReturnValue = js::ReturnValue<T>;
MethodMap<T> const methods = { MethodMap<T> const methods = {
{"isValid", wrap<RealmObject::is_valid>}, {"isValid", wrap<RealmObject::is_valid>},
}; };

View File

@ -23,8 +23,6 @@
#include "js_class.hpp" #include "js_class.hpp"
#include "js_util.hpp" #include "js_util.hpp"
#include "results.hpp"
namespace realm { namespace realm {
namespace jsc { namespace jsc {

View File

@ -23,8 +23,6 @@
#include "js_class.hpp" #include "js_class.hpp"
#include "js_util.hpp" #include "js_util.hpp"
#include "results.hpp"
namespace realm { namespace realm {
namespace node { namespace node {

View File

@ -437,7 +437,7 @@ module.exports = BaseTest.extend({
var realm = new Realm({schema: [schemas.TestObject]}); var realm = new Realm({schema: [schemas.TestObject]});
realm.write(function() { realm.write(function() {
var obj = realm.create('TestObject', {doubleCol: 1}); var obj = realm.create('TestObject', {doubleCol: 1});
TestCase.assertTrue(obj instanceof Realm.RealmObject); TestCase.assertTrue(obj instanceof Realm.Object);
}); });
}, },