mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-28 23:35:05 +00:00
pr fixes
This commit is contained in:
parent
591dce8051
commit
27d973151f
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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";
|
||||||
@ -61,12 +65,6 @@ struct RealmObjectClass : ClassDefinition<T, realm::Object> {
|
|||||||
wrap<RealmObject::set_property>,
|
wrap<RealmObject::set_property>,
|
||||||
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>},
|
||||||
|
@ -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 {
|
||||||
|
|
||||||
|
@ -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 {
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ namespace realm {
|
|||||||
SharedRealm realm() { return m_realm; }
|
SharedRealm realm() { return m_realm; }
|
||||||
const ObjectSchema &get_object_schema() { return *m_object_schema; }
|
const ObjectSchema &get_object_schema() { return *m_object_schema; }
|
||||||
Row row() { return m_row; }
|
Row row() { return m_row; }
|
||||||
|
|
||||||
bool is_valid() const { return m_row.is_attached(); }
|
bool is_valid() const { return m_row.is_attached(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -147,7 +147,7 @@ namespace realm {
|
|||||||
//
|
//
|
||||||
template <typename ValueType, typename ContextType>
|
template <typename ValueType, typename ContextType>
|
||||||
inline void Object::set_property_value(ContextType ctx, std::string prop_name, ValueType value, bool try_update)
|
inline void Object::set_property_value(ContextType ctx, std::string prop_name, ValueType value, bool try_update)
|
||||||
{
|
{
|
||||||
const Property *prop = m_object_schema->property_for_name(prop_name);
|
const Property *prop = m_object_schema->property_for_name(prop_name);
|
||||||
if (!prop) {
|
if (!prop) {
|
||||||
throw InvalidPropertyException(m_object_schema->name, prop_name,
|
throw InvalidPropertyException(m_object_schema->name, prop_name,
|
||||||
|
@ -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);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user