I want to know how it works so that everyone can see the random value simultaneously.
It works on server or client ? And how to write it? Now i do it on Template.name.onRendered it will only work when i enter. Not real time .
this link : https://gamdom.com/crash
Template.randomX.onRendered(function() {
var Seconds = new Date().getTime() + 5000;
var x = (Math.random() * 10).toFixed(2);
Session.set('value', x)
$('#random').countdown(Seconds, function(event) {
$(this).html(event.strftime('Next round in %Ss'));
}).on('finish.countdown', function() {
$(this).html('Busted <br>@ <b>' + x + 'x</b>');;
var MD5 = new Hashes.MD5;
Games.insert({
x,
createdAt: new Date(),
owner: Meteor.userId(),
at: '-',
bet: '-',
bonus: '-',
profit: '-',
hash: MD5.hex(x),
});
});
});
Sorry, I’m not good at English