File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -58,11 +58,17 @@ export default class App extends Vue {
5858 }
5959
6060 private async playEntrySound () {
61- const skipCookieName = ' skipEntrySound '
61+ const timeoutKey = ' entrySoundTimeout '
6262
63- // check for a skip cookie
64- if (Cookies .get (skipCookieName )) {
65- return
63+ // check timeout
64+ const timeoutRaw = localStorage .getItem (timeoutKey )
65+ if (timeoutRaw ) {
66+ const now: Date = new Date ()
67+ const timeout: Date = new Date (parseInt (timeoutRaw ))
68+
69+ if (now < timeout ) {
70+ return
71+ }
6672 }
6773
6874 // load the user's entry sound
@@ -76,10 +82,10 @@ export default class App extends Vue {
7682 // play the user's entry sound
7783 await this .$api .put (` /sound/sounds/${preferences .entrySoundId }/play/ ` )
7884
79- // set the skip cookie
80- const expires = new Date ()
81- expires .setMinutes (expires .getMinutes () + 15 )
82- Cookies . set ( skipCookieName , ' true ' , { expires , path: ' /noop ' } )
85+ // set timeout
86+ const newTimeout = new Date ()
87+ newTimeout .setMinutes (newTimeout .getMinutes () + 15 )
88+ localStorage . setItem ( timeoutKey , newTimeout . getTime (). toString () )
8389 }
8490}
8591 </script >
You can’t perform that action at this time.
0 commit comments