diff --git a/lib/index.js b/lib/index.js index 46ad49c6..8caaa960 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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!'); }