JavaScript code that provides the countdown behaviour which is UI and library agnostic