mirror of
https://github.com/amark/gun.git
synced 2025-06-22 14:02:33 +00:00
36 lines
851 B
JavaScript
36 lines
851 B
JavaScript
test(function(peers){
|
|
console.log(peers.just);
|
|
peers.client(function(){
|
|
console.log("JESSE FREAK OUT!");
|
|
localStorage.clear();
|
|
});
|
|
|
|
peers.env({
|
|
key: 'SUPERPANICAWESOMESAUCEYAY',
|
|
url: 'http://gungame.herokuapp.com/gun'
|
|
})
|
|
|
|
peers.just("Alice", function(test){
|
|
var gun = Gun(test.env.url);
|
|
gun.put({hello: 'WORLD HISTORY!!!!'}).key(this.env.key, function(err, ok){
|
|
if(!err || (err.err || err).match('memory')){
|
|
test.done();
|
|
}
|
|
});
|
|
});
|
|
|
|
['bob', 'carl', 'dave', 'eve', 'fred'].forEach(function(name){
|
|
console.log("PEERS!", name);
|
|
peers.just(name, function(test){
|
|
var gun = Gun(test.env.url);
|
|
gun.get(this.env.key).val(function(data){
|
|
console.log("BOB READ DATA", data);
|
|
if(data.hello === 'WORLD HISTORY!!!!'){
|
|
test.done();
|
|
} else {
|
|
test.fail("Data was corrupted");
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}); |