Merge pull request #269 from realm/al-example-class

Use classes in the example
This commit is contained in:
Ari Lazier 2016-02-21 17:40:28 -08:00
commit 4c965fd09c

View File

@ -6,21 +6,20 @@
import Realm from 'realm';
export default new Realm({
schema: [
{
name: 'Todo',
properties: {
done: {type: Realm.Types.BOOL, default: false},
text: Realm.Types.STRING,
},
},
{
name: 'TodoList',
properties: {
name: Realm.Types.STRING,
items: {type: Realm.Types.LIST, objectType: 'Todo', default: []},
},
},
],
});
class Todo {}
Todo.schema = {
name: 'Todo',
properties: {
done: {type: Realm.Types.BOOL, default: false},
text: Realm.Types.STRING,
},
};
class TodoList {}
TodoList.schema = {
name: 'TodoList',
properties: {
name: Realm.Types.STRING,
items: {type: Realm.Types.LIST, objectType: 'Todo', default: []},
},
};
export default new Realm({schema: [Todo, TodoList]});