fix RN by moving require

This commit is contained in:
Mark Nadal 2020-05-21 14:20:30 -07:00
parent 99cb0e92df
commit 125e1384c1
3 changed files with 10 additions and 3 deletions

View File

@ -73,4 +73,12 @@ function Store(opt){
return store;
}
var Gun = (typeof window !== "undefined")? window.Gun : require('../gun');
Gun.on('create', function(root){
this.to.next(root);
var opt = root.opt;
if(opt.rfs === false){ return }
opt.store = opt.store || (!Gun.window && Store(opt));
});
module.exports = Store;

View File

@ -12,6 +12,7 @@
require('../nts');
require('./store');
require('./rs3');
require('./rfs');
require('./wire');
try{require('../sea');}catch(e){}
try{require('../axe');}catch(e){}

View File

@ -7,10 +7,8 @@ Gun.on('create', function(root){
if(false === opt.radisk){ return }
var Radisk = (Gun.window && Gun.window.Radisk) || require('./radisk');
var Radix = Radisk.Radix;
var ST = 0;
// TODO: BUG! For RN storage, RN does not like the following require:
opt.store = opt.store || (!Gun.window && require('./rfs')(opt));
var dare = Radisk(opt), esc = String.fromCharCode(27);
var ST = 0;
root.on('put', function(msg){
this.to.next(msg);