snooze.callback

Snooze Callback to call when time is up. It will help to avoid redundancy work such as hitting database query, or network call. We used this package to future schedule events.

Usage no npm install needed!

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

README

snooze-callback

Snooze Callback to call when time is up. It will help to avoid redundancy work such as hitting database query, or network call. We used this package to future schedule events.

debug

set environment: DEBUG="snooze*"

example

const { watch, intervalTime, cancel } = require('./index');

intervalTime(1000);
const timeObj = {
        '2018-10-10T16:12:48.761Z': { context: this, data: "hello world"},
        '2018-10-10T16:14:46.761Z': { someFun: () => console.log('yay',timeObj), data: "hello world"}
}

watch( timeObj, function (error, data) { 
        if (error) return cancel() 
        console.log("Callback Trigger with param", data);
}, this);