CLEAR

WeatherModule


The WeatherModule class provides information about the current weather

Example

const Weather = require('Weather');

Weather.getWeather().then(function(weatherJson){
  // Weather information is available here
    weatherJson.sunriseHour // Ex.: 6
    weatherJson.sunriseMinute // Ex.: 30
    weatherJson.sunsetHour // Ex.: 21
    weatherJson.sunsetMinute // Ex.: 45
    weatherJson.preferredTempUnit // Ex.: "CELSIUS" | "FAHRENHEIT"
    weatherJson.tempCelsius // Ex.: 27.0
    weatherJson.tempFahrenheit // Ex.: 80.6
    weatherJson.currentConditionCode // Ex.: "SUNNY"
});

Properties

This class exposes no properties.

Methods

MethodDescription

getWeather

getWeather(): Promise<Weather>

Returns a JS Promise which will be fulfilled with Weather object or an error.