Merge pull request #198 from realm/sk-error-message

Error message when RealmReact framework is missing
This commit is contained in:
Scott Kyle 2016-01-12 17:08:43 -08:00
commit 04efd77940
1 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,11 @@
'use strict';
if (typeof Realm != 'undefined') {
// The global Realm constructor should be available on device (using JavaScriptCore).
module.exports = Realm; // eslint-disable-line no-undef
} else {
} else if (navigator.userAgent) {
// The userAgent will be defined when running in a browser (such as Chrome debugging mode).
module.exports = require('./realm');
} else {
throw new Error('Missing Realm constructor - please ensure RealmReact framework is included!');
}