day-events

1.0.1 • Public • Published

Day Events

Event emitter for daily events like sunrise, sunset, dawn, dusk, etc.

Usage

DayEvents is an EventEmitter that will emit events as they happen during the day, in real time. The events come from the SunCalc library and documented constants are included with the plugin.

const {
  DayEvents,
  eventNames: { SUNRISE, SUNSET } 
= require('day-events');
 
let latitude = 45.5231;
let longitude = -122.6765;
 
let today = new DayEvents(latitude, longitude);
 
today.on(SUNRISE, () => console.log('Good morning!'));
today.on(SUNSET, () => console.log('Good evening!'));
 
let eventTimes = today.getTimes();
console.log(`Sunset is at ${eventTimes[SUNSET].toString()}`);

Readme

Keywords

none

Package Sidebar

Install

npm i day-events

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

9.7 kB

Total Files

12

Last publish

Collaborators

  • doingweb