0.63.0 • Published 1 year ago

@curium.rocks/owm-emitter v0.63.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

OWM-Emitter

Security Rating Coverage Quality Gate Status

Description

This library polls the OpenWeatherMap Onecall API, detects changes, and on change, emits a event to listeners.

How to install

npm install --save @curium.rocks/owm-emitter

API Documentation

You can view the API documentation here.

Examples

Imports

import {OwmEmitter, OwmEmitterOptions, OneCallApiResponse, IDataEvent} from "@curium.rocks/owm-emitter";

Creating the options object

const owmOptions:OwmEmitterOptions = {
    id: 'your-unique-id',
    description: 'Some full text description associated to this emitter',
    name: 'your emitter name',
    checkInterval: 300000, // check for updates every 5 minutes
    appId: 'your owm app id/key',
    latitude: 0.0, // set latitude and longitude to the area you want to get weather data for
    longitude: 0.0
}

Log all alerts to console

const emitter = new OwmEmitter(owmOptions);
try {
    const listener = emitter.onData((evt: IDataEvent) => {
        const oneCallData: OneCallApiResponse = evt.data as OneCallApiResponse;
        oneCallData.alerts?.forEach((alert)=>{
            console.log(`Weather Alert: 
                         description = ${alert.description},
                         start = ${alert.start}, 
                         end = ${alert.end}, 
                         event = ${alert.event}, 
                         sender = ${alert.sender_name}`)
        });
    });
    emitter.startPolling();
} finally {
    emitter.dispose();
}
0.62.0

1 year ago

0.60.0

1 year ago

0.59.0

1 year ago

0.57.0

1 year ago

0.55.0

1 year ago

0.63.0

1 year ago

0.61.0

1 year ago

0.58.0

1 year ago

0.56.0

1 year ago

0.43.0

2 years ago

0.20.0

2 years ago

0.41.0

2 years ago

0.19.0

2 years ago

0.38.0

2 years ago

0.36.0

2 years ago

0.34.0

2 years ago

0.11.0

2 years ago

0.13.0

2 years ago

0.15.0

2 years ago

0.17.0

2 years ago

0.53.0

2 years ago

0.32.0

2 years ago

0.51.0

2 years ago

0.30.0

2 years ago

0.29.0

2 years ago

0.48.0

2 years ago

0.27.0

2 years ago

0.46.0

2 years ago

0.25.0

2 years ago

0.44.0

2 years ago

0.23.0

2 years ago

0.9.0

2 years ago

0.5.0

2 years ago

0.7.0

2 years ago

0.42.0

2 years ago

0.21.0

2 years ago

0.40.0

2 years ago

0.39.0

2 years ago

0.37.0

2 years ago

0.35.0

2 years ago

0.33.0

2 years ago

0.12.0

2 years ago

0.14.0

2 years ago

0.16.0

2 years ago

0.18.0

2 years ago

0.10.0

2 years ago

0.54.0

2 years ago

0.31.0

2 years ago

0.52.0

2 years ago

0.50.0

2 years ago

0.28.0

2 years ago

0.49.0

2 years ago

0.26.0

2 years ago

0.47.0

2 years ago

0.24.0

2 years ago

0.45.0

2 years ago

0.22.0

2 years ago

0.8.0

2 years ago

0.4.0

2 years ago

0.6.0

2 years ago

0.1.1-20

2 years ago

0.1.1-21

2 years ago

0.1.1-22

2 years ago

0.3.0

2 years ago

0.1.1-18

2 years ago

0.2.0

2 years ago

0.1.1-19

2 years ago

0.1.1-16

2 years ago

0.1.1-17

2 years ago

0.1.1-12

2 years ago

0.1.1-13

2 years ago

0.1.1-14

2 years ago

0.1.1-15

2 years ago

0.1.1-11

2 years ago

0.1.1-10

3 years ago

0.1.1-9

3 years ago

0.1.1-8

3 years ago

0.1.1-7

3 years ago

0.1.1-6

3 years ago

0.1.1-5

3 years ago

0.1.1-4

3 years ago

0.1.1-3

3 years ago

0.1.1-2

3 years ago

0.1.1-1

3 years ago

0.1.1-0

3 years ago