-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2324 from constantine2nd/develop
Add props set_response_header_Set-Cookie
- Loading branch information
Showing
5 changed files
with
71 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
function addSeconds(date, seconds) { | ||
date.setSeconds(date.getSeconds() + seconds); | ||
return date; | ||
} | ||
|
||
export function showCountdownTimer() { | ||
|
||
// Get current date and time | ||
var now = new Date().getTime(); | ||
let distance = countDownDate - now; | ||
|
||
// Output the result in an element with id="countdown-timer-span" | ||
let elementId = ("countdown-timer-span"); | ||
document.getElementById(elementId).innerHTML = "in " + Math.floor(distance / 1000) + "s"; | ||
|
||
// If the count down is over release resources | ||
if (distance < 0) { | ||
destroyCountdownTimer(); | ||
} | ||
} | ||
|
||
|
||
// Set the date we're counting down to | ||
let countDownDate = addSeconds(new Date(), 5); | ||
|
||
let showTimerInterval = null; | ||
|
||
export function destroyCountdownTimer() { | ||
clearInterval(showTimerInterval); | ||
} | ||
|
||
export function resetCountdownTimer(seconds) { | ||
destroyCountdownTimer(); // Destroy previous timer if any | ||
countDownDate = addSeconds(new Date(), seconds); // Set the date we're counting down to | ||
showTimerInterval = setInterval(showCountdownTimer, 1000); // Update the count down every 1 second | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters