JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q32183F
  • License MIT

A simple Node.js module for integrating with the Forecast.io API

Package Exports

  • weatherman.io

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (weatherman.io) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

weatherman.io

A simple Node.js module for integrating with the Forecast.io API.

Install it

 npm install weatherman.io

Require it

 var weatherman = require( 'weatherman.io' );

Create a weatherman

 var alRoker = weatherman( 'your-forecast-io-api-key' );

Go on location and do the forecast

 var latitude = 41.8854710;
 var longitude = -87.6430260;

 alRoker.goOnLocation( latitude, longitude );
 alRoker.doForecast( function ( err, weatherReport ) {
     if ( err ) {
         // handle any errors
     }
     // do something with the weatherReport
 } );

Do the forecast for a specific time

 var latitude = 41.8854710;
 var longitude = -87.6430260;
 var unixTimeStamp = 1395347280;

 alRoker.goOnLocation( latitude, longitude );
 alRoker.doForecastAtTime( unixTimeStamp, function ( err, weatherReport ) {
     if ( err ) {
         // handle any errors
     }
     // do something with the weatherReport
 } );

Set custom options

Set the options object with the desired properties before calling doForecast. You only need to define the option properties you need. The example below demonstrates changing all three at once. Detailed information about each of these options is available in the Forecast.io developer docs: https://developer.forecast.io/docs/v2

alRoker.options = {
    units: "uk",
    exclude: ["minutely", "alerts"],
    extend: "hourly"
};