UNPKG

gun

Version:

A realtime, decentralized, offline-first, graph data synchronization engine.

27 lines (22 loc) 548 B
<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>