mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
commit
a1cf374d87
@ -1,5 +1,13 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 0.3.7
|
||||
|
||||
- Catch localStorage errors.
|
||||
|
||||
## 0.3.6
|
||||
|
||||
- Fixed S3 typo.
|
||||
|
||||
## 0.3.5
|
||||
|
||||
- Fixed server push.
|
||||
|
6
gun.js
6
gun.js
@ -1140,8 +1140,8 @@
|
||||
|
||||
;(function(exports){
|
||||
function s(){}
|
||||
s.put = function(key, val){ return store.setItem(key, Gun.text.ify(val)) }
|
||||
s.get = function(key, cb){ /*setTimeout(function(){*/ return cb(null, Gun.obj.ify(store.getItem(key) || null)) /*},1)*/}
|
||||
s.put = function(key, val, cb){ try{ store.setItem(key, Gun.text.ify(val)) }catch(e){if(cb)cb(e)} }
|
||||
s.get = function(key, cb){ /*setTimeout(function(){*/ try{ cb(null, Gun.obj.ify(store.getItem(key) || null)) }catch(e){cb(e)} /*},1)*/}
|
||||
s.del = function(key){ return store.removeItem(key) }
|
||||
var store = this.localStorage || {setItem: function(){}, removeItem: function(){}, getItem: function(){}};
|
||||
exports.store = s;
|
||||
@ -1192,7 +1192,7 @@
|
||||
(opt.headers = Gun.obj.copy(tab.headers)).id = tab.msg();
|
||||
Gun.is.graph(graph, function(node, soul){
|
||||
if(!gun.__.graph[soul]){ return }
|
||||
tab.store.put(tab.prefix + soul, gun.__.graph[soul]);
|
||||
tab.store.put(tab.prefix + soul, gun.__.graph[soul], function(err){if(err){ cb({err: err}) }});
|
||||
});
|
||||
if(!(cb.local = opt.local)){
|
||||
tab.request.s[opt.headers.id] = tab.error(cb, "Error: Put failed!");
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gun",
|
||||
"version": "0.3.6",
|
||||
"version": "0.3.7",
|
||||
"description": "Graph engine",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -3780,6 +3780,22 @@ describe('Gun', function(){
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("localStorage", function(done){
|
||||
var localStorage = localStorage || {clear:function(){}};
|
||||
localStorage.clear();
|
||||
var gun = Gun();
|
||||
|
||||
|
||||
var text = Gun.text.random(1024 * 1024 * 6);
|
||||
gun.put({i: text}, function(err, ok){
|
||||
if(done.c){ return }
|
||||
if(!err){ return done() }
|
||||
var text = "If you are seeing this message, it means the localStorage error was caught successfully rather than it crashing and stopping replication to peers. Also, the error is now reported back to you via the put callback. Here it is!";
|
||||
localStorage.clear();
|
||||
done(); done.c = 1;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Streams', function(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user