gun
Version:
A realtime, decentralized, offline-first, graph data synchronization engine.
27 lines (25 loc) • 878 B
JavaScript
var User = require('./user'), SEA = User.SEA, Gun = User.GUN;
User.prototype.recall = function(opt, cb){
var gun = this, root = gun.back(-1), tmp;
opt = opt || {};
if(opt && opt.sessionStorage){
if(SEA.window){
try{
var sS = {};
sS = SEA.window.sessionStorage; // TODO: FIX BUG putting on `.is`!
if(sS){
(root._).opt.remember = true;
((gun.back('user')._).opt||opt).remember = true;
if(sS.recall || sS.pair) root.user().auth(JSON.parse(sS.pair), cb); // pair is more reliable than alias/pass
}
}catch(e){}
}
return gun;
}
/*
TODO: copy mhelander's expiry code back in.
Although, we should check with community,
should expiry be core or a plugin?
*/
return gun;
}