Check if there is a global console to silent eslint

This commit is contained in:
Marius Rackwitz 2016-07-25 16:26:28 +02:00 committed by Ari Lazier
parent c361031e36
commit 48b106e610
1 changed files with 12 additions and 7 deletions

View File

@ -54,13 +54,18 @@ var types = Object.freeze({
});
Object.defineProperty(realmConstructor, 'Types', {
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);
if (typeof console != 'undefined') {
/* global console */
/* eslint-disable no-console */
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);
}
/* eslint-enable no-console */
}
return types;
}