Disable button after pressing for 60 seconds even if browser refreshes with Meteor

I've searched a lot of trial and error but found a solution for this problem. I have found solutions but have no success in implementing anything.

I am using Meteor and want to create an enter button / that turns off within 60 seconds after being pressed. I can do this part, but my biggest problem is that browser refresh makes the button re-clicked.

Can I associate a timer with a user id? Any help would be greatly appreciated. I read about Date.now (); and Sugar JS but couldn't get them to work for my application.

+3


source to share


1 answer


you can use html localstorage. eg:

WHILE CLICKED BUTTON SET THIS.
     localStorage.setItem('status', 1);

While 60 sec complete then apply
     localStorage.setItem('status', 0);

      



and check every time the button click weather localstorage is 0 or 1.

if 0 submit else return false. And to get localstorage value use as
localStorage.getItem('status');

      

+6


source







All Articles