alarms

A simple package that will execute the specified function at specified time

Usage no npm install needed!

<script type="module">
  import alarms from 'https://cdn.skypack.dev/alarms';
</script>

README

Alarms

A simple alarm that will execute specified function at specified time.

Usage

const alarms = require('alarms')

alarms({ hour: 13, minute: 45, second: 17, daily: true, verbose: false }, () => console.log('Alarm!'))

Parameters

The first argument is the alarm setting, which should be a object contains:

  • hour: number, required.
  • minute: number, required.
  • second: number, default: 0.
  • daily: boolean, default: false.
    • If daily is true, the alarm will repeat everyday.
  • verbose: boolean, default: false.
    • If verbose is true, it will output some log when the function is executed.

TODO lists

  • Alarms can be canceled.
  • Custom repeat period.
  • Parameter can be a Date object.