Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WeatherCalculator

Fetch current weather information for a given city, province.

Hierarchy

Index

Properties

city

city: string

The city to fetch the weather for. Must be one of the predefined cities for the specified province.

Protected fetchState

fetchState: number = 0

humidity

humidity: number

The current relative humidity (%).

province

province: string

The province to fetch the weather for (can be either the full name or abbreviation).

temperature

temperature: number

The current temperature (in celsius).

time

time: string

The observation time for the weather conditions.

windDirection

windDirection: number

The current wind direction (degrees).

windSpeed

windSpeed: number

The current wind speed (km/h).

Static Private Readonly GET_WEATHER_KEY

GET_WEATHER_KEY: "WEATHER_GET" = "WEATHER_GET"

Methods

fetchWeather

Private fetchWeatherInternal

  • fetchWeatherInternal(callback?: (defaults: WeatherCalculator) => any, error?: (message: any) => any): void
  • Parameters

    Returns void

fetchWeatherPromise

  • Get the current weather conditions for the specified province and city.

    throws

    This method can only be called once at a time per instance.

    Returns Promise<WeatherCalculator>

    A WeatherCalculator object that contains the current weather conditions for the specified city and province.

Static getCities

  • getCities(province: Province, callback?: (defaults: string[]) => any): void
  • Get a list of supported cities in the provided province.

    Parameters

    • province: Province
    • Optional callback: (defaults: string[]) => any
        • (defaults: string[]): any
        • Parameters

          • defaults: string[]

          Returns any

    Returns void

Static getCitiesPromise

  • getCitiesPromise(province: Province): Promise<Array<string>>
  • Get a list of supported cities in the provided province.

    Parameters

    • province: Province

      The province to get the supported cities in.

    Returns Promise<Array<string>>

    An array of city names.