mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-10 22:36:01 +00:00
Warn when Realm.Types is still used
This commit is contained in:
parent
9d25435105
commit
7755e7030b
33
lib/index.js
33
lib/index.js
@ -41,18 +41,29 @@ if (typeof Realm != 'undefined') {
|
||||
Object.defineProperties(realmConstructor.Collection.prototype, arrayMethods);
|
||||
|
||||
// TODO: Remove this now useless object.
|
||||
var types = Object.freeze({
|
||||
'BOOL': 'bool',
|
||||
'INT': 'int',
|
||||
'FLOAT': 'float',
|
||||
'DOUBLE': 'double',
|
||||
'STRING': 'string',
|
||||
'DATE': 'date',
|
||||
'DATA': 'data',
|
||||
'OBJECT': 'object',
|
||||
'LIST': 'list',
|
||||
});
|
||||
Object.defineProperty(realmConstructor, 'Types', {
|
||||
value: Object.freeze({
|
||||
'BOOL': 'bool',
|
||||
'INT': 'int',
|
||||
'FLOAT': 'float',
|
||||
'DOUBLE': 'double',
|
||||
'STRING': 'string',
|
||||
'DATE': 'date',
|
||||
'DATA': 'data',
|
||||
'OBJECT': 'object',
|
||||
'LIST': 'list',
|
||||
})
|
||||
get: function() {
|
||||
var stack = new Error().stack.split("\n").slice(2).join("\n");
|
||||
var msg = '`Realm.Types` is deprecated! Please specify the type name as lowercase string instead!\n'+stack;
|
||||
if (console.warn != undefined) {
|
||||
console.warn(msg);
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
return types;
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = realmConstructor;
|
||||
|
Loading…
x
Reference in New Issue
Block a user