Workaround to load realm from ubuntu_server.js

This commit is contained in:
Max Risuhin 2017-12-23 20:31:49 +02:00
parent 1b0f6c0b21
commit 65d4fb7747
No known key found for this signature in database
GPG Key ID: BF733F5ACA0B4448
1 changed files with 11 additions and 0 deletions

View File

@ -18,6 +18,13 @@
'use strict'; 'use strict';
console.log("outerRealmConstructor: " + typeof outerRealmConstructor);
if (typeof outerRealmConstructor !== 'undefined') {
var realmConstructor = outerRealmConstructor;
module.exports = realmConstructor;
}
if (typeof outerRealmConstructor === 'undefined') {
const require_method = require; const require_method = require;
// Prevent React Native packager from seeing modules required with this // Prevent React Native packager from seeing modules required with this
@ -57,6 +64,9 @@ function getContext() {
return 'chromedebugger'; return 'chromedebugger';
} }
// react-native-desktop expects "nodejs" env
return 'nodejs';
// Otherwise, we must be in a "normal" react native situation. // Otherwise, we must be in a "normal" react native situation.
// In that case, the Realm type should have been injected by the native code. // In that case, the Realm type should have been injected by the native code.
// If it hasn't, the user likely forgot to run link. // If it hasn't, the user likely forgot to run link.
@ -120,3 +130,4 @@ if (!realmConstructor) {
require('./extensions')(realmConstructor); require('./extensions')(realmConstructor);
module.exports = realmConstructor; module.exports = realmConstructor;
}