How to use the gun.state function in gun

To help you get started, we’ve selected a few gun examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github amark / gun / test / panic / b2s2s2b.js View on Github external
tests.push(client.run(function(test){
				Gun.state.drift = Math.random() * 10000;	
				localStorage.clear();
				var env = test.props;
				test.async();
				var peers = [], i = env.i;
				//while(i--){
					peers.push('http://'+ env.config.IP + ':' + (env.config.port + (i)) + '/gun');
				//}
				console.log("Connect to", peers);
				var gun = Gun(peers);
				var num = 0, total = 0, check = Gun.obj.map(env.ids, function(v,id,t){
					var i = env.config.each;
					while(i--){
						t(id + (i + 1), 1);
						total += 1;
					}
				});
github irislib / iris-lib / src / chat.js View on Github external
const update = () => {
        gun.user().get(`lastActive`).put(Math.round(Gun.state() / 1000));
      };
      update();

gun

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

(Zlib OR MIT OR Apache-2.0)
Latest version published 1 year ago

Package Health Score

64 / 100
Full package analysis