mirror of
https://github.com/amark/gun.git
synced 2025-06-07 22:56:42 +00:00
Update gun.js
This commit is contained in:
parent
d1c4df7688
commit
9355a36a54
6
gun.js
6
gun.js
@ -2031,8 +2031,7 @@
|
|||||||
var store = root.localStorage || {setItem: noop, removeItem: noop, getItem: noop};
|
var store = root.localStorage || {setItem: noop, removeItem: noop, getItem: noop};
|
||||||
|
|
||||||
function put(at){ var err, id, opt, root = at.gun._.root;
|
function put(at){ var err, id, opt, root = at.gun._.root;
|
||||||
opt = at.opt || ( at.opt = at.gun.Back('opt') || {} );
|
(opt = at.opt || {}).prefix = opt.prefix || (at.gun.Back('opt')||{}).prefix || 'gun/';
|
||||||
opt.prefix = opt.prefix || 'gun/';
|
|
||||||
Gun.graph.is(at.put, function(node, soul){
|
Gun.graph.is(at.put, function(node, soul){
|
||||||
//try{store.setItem(opt.prefix + soul, Gun.text.ify(node));
|
//try{store.setItem(opt.prefix + soul, Gun.text.ify(node));
|
||||||
try{store.setItem(opt.prefix + soul, Gun.text.ify(root._.graph[soul]||node));
|
try{store.setItem(opt.prefix + soul, Gun.text.ify(root._.graph[soul]||node));
|
||||||
@ -2044,8 +2043,7 @@
|
|||||||
function get(at){
|
function get(at){
|
||||||
var gun = at.gun, lex = at.get, soul, data, opt, u;
|
var gun = at.gun, lex = at.get, soul, data, opt, u;
|
||||||
//setTimeout(function(){
|
//setTimeout(function(){
|
||||||
opt = at.opt || ( at.opt = at.gun.Back('opt') || {} );
|
(opt = at.opt || {}).prefix = opt.prefix || (at.gun.Back('opt')||{}).prefix || 'gun/';
|
||||||
opt.prefix = opt.prefix || 'gun/';
|
|
||||||
if(!lex || !(soul = lex[Gun._.soul])){ return }
|
if(!lex || !(soul = lex[Gun._.soul])){ return }
|
||||||
data = Gun.obj.ify(store.getItem(opt.prefix + soul) || null);
|
data = Gun.obj.ify(store.getItem(opt.prefix + soul) || null);
|
||||||
if(!data){ return } // localStorage isn't trustworthy to say "not found".
|
if(!data){ return } // localStorage isn't trustworthy to say "not found".
|
||||||
|
Loading…
x
Reference in New Issue
Block a user