mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
localStorage:error event
This commit is contained in:
parent
6fd70c3e6a
commit
80840725e4
@ -126,6 +126,7 @@
|
||||
}
|
||||
|
||||
chat.map().val(function(msg, id){
|
||||
if(!msg){ return }
|
||||
var ul = $('ul');
|
||||
var last = sort(msg.when, ul.children('li').last());
|
||||
|
||||
|
@ -95,7 +95,7 @@
|
||||
</form>
|
||||
<div>
|
||||
<ul name="said">
|
||||
<li name="#" class="sit sort shade rim"><div name="what" class="rim sit"></div></li>
|
||||
<li name="#" class="sit sort shade rim"><div name="what" class="rim"></div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
5
gun.js
5
gun.js
@ -1877,7 +1877,10 @@
|
||||
var ack = acks;
|
||||
acks = {};
|
||||
try{store.setItem(opt.file, JSON.stringify(disk));
|
||||
}catch(e){ Gun.log(err = e || "localStorage failure") }
|
||||
}catch(e){
|
||||
Gun.log(err = e || "localStorage failure");
|
||||
root.on('localStorage:error', {err: err, file: opt.file});
|
||||
}
|
||||
if(!err && !Gun.obj.empty(opt.peers)){ return } // only ack if there are no peers.
|
||||
Gun.obj.map(ack, function(yes, id){
|
||||
root.on('in', {
|
||||
|
2
gun.min.js
vendored
2
gun.min.js
vendored
File diff suppressed because one or more lines are too long
@ -128,7 +128,10 @@ Gun.on('create', function(root){
|
||||
var ack = acks;
|
||||
acks = {};
|
||||
try{store.setItem(opt.file, JSON.stringify(disk));
|
||||
}catch(e){ Gun.log(err = e || "localStorage failure") }
|
||||
}catch(e){
|
||||
Gun.log(err = e || "localStorage failure");
|
||||
root.on('localStorage:error', {err: err, file: opt.file});
|
||||
}
|
||||
if(!err && !Gun.obj.empty(opt.peers)){ return } // only ack if there are no peers.
|
||||
Gun.obj.map(ack, function(yes, id){
|
||||
root.on('in', {
|
||||
|
@ -1,10 +1,10 @@
|
||||
|
||||
var Gun = require('./root');
|
||||
Gun.chain.get = function(key, cb, as){
|
||||
var gun;
|
||||
var gun, tmp;
|
||||
if(typeof key === 'string'){
|
||||
var back = this, cat = back._;
|
||||
var next = cat.next || empty, tmp;
|
||||
var next = cat.next || empty;
|
||||
if(!(gun = next[key])){
|
||||
gun = cache(key, back);
|
||||
}
|
||||
@ -25,6 +25,9 @@ Gun.chain.get = function(key, cb, as){
|
||||
} else
|
||||
if(num_is(key)){
|
||||
return this.get(''+key, cb, as);
|
||||
} else
|
||||
if(tmp = rel.is(key)){
|
||||
return this.get(tmp, cb, as);
|
||||
} else {
|
||||
(as = this.chain())._.err = {err: Gun.log('Invalid get request!', key)}; // CLEAN UP
|
||||
if(cb){ cb.call(as, as._.err) }
|
||||
|
@ -68,7 +68,7 @@ describe("Make sure the Radix Storage Engine (RSE) works.", function(){
|
||||
});
|
||||
var Gun = require('gun');
|
||||
require('gun/lib/store');
|
||||
var gun = Gun({web: server, localStorage: false, thrash: 6000});
|
||||
var gun = Gun({web: server, localStorage: false, until: 6000});
|
||||
server.listen(port, function(){
|
||||
test.done();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user