mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
27 lines
548 B
HTML
27 lines
548 B
HTML
<script src="../../gun.js"></script>
|
|
<script>
|
|
;(function(){
|
|
//localStorage.clear();
|
|
|
|
var gun = window.gun = Gun('http://localhost:8765/gun');
|
|
var user = window.user = gun.get('pub/alice');
|
|
return;
|
|
user.put({pub: 'alice'}, write);
|
|
|
|
|
|
function write(data){
|
|
console.log("write...");
|
|
user.get('profile').get('said').set({
|
|
what: "Hello world! " + Gun.text.random(3)
|
|
}, get);
|
|
}
|
|
|
|
function get(){
|
|
console.log("get...");
|
|
user.get('profile').get('said').map().val(function(data){
|
|
console.log("read...", data);
|
|
})
|
|
}
|
|
|
|
}());
|
|
</script> |