Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 1.02 KB

README.md

File metadata and controls

40 lines (32 loc) · 1.02 KB

<digital-clock>

Published on webcomponents.org

A simple clock component, displaying the current date and time into the local format.

It's possible to set an alarm.

Quick example

<digital-clock></digital-clock>
<audio src="demo/Zen_Temple_Bell.mp3" id="alarm"></audio>
<script>
const clock = document.querySelector('digital-clock');
let now = new Date();
now.setMinutes(now.getMinutes() + 1);
now.setSeconds(0);

clock.alarm = now.toISOString();
clock.addEventListener('clock-alarm', () => {
  document.getElementById("alarm").play();
});
</script>

The component is licensed under the ISC License