Skip to content

Commit

Permalink
added more code documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
blakewatson committed May 31, 2021
1 parent 76a926d commit 777f8c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions public/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import $ from "cash-dom";
import { initTimer } from './timer';
import { initAjax } from "./ajax";

// if fetch is supported, turn on ajax features
if (fetch) {
initTimer();
initAjax();
}

// initializes the date picker widget
function initFlatpickr() {
flatpickr("#rd", {
mode: "range",
Expand All @@ -16,5 +18,7 @@ function initFlatpickr() {
});
}

// initialize the date picker on page load
initFlatpickr();
// initialize the date picker after body swaps
$(window).on('postbodyswap', initFlatpickr);
5 changes: 5 additions & 0 deletions public/assets/js/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ function validate(state) {
}
}

/**
* Initializes the timer display. It gets the initial elapsed time, starts the
* animation loop for the timer, shows the timer running icon, and hides the
* "Refresh" link.
*/
function initTimerDisplay() {
// get initial elapsed time if available
const initialElapsed = elapsedTimeToMs($('[data-timer-elapsed]').data('timer-elapsed'));
Expand Down

0 comments on commit 777f8c0

Please sign in to comment.