UNPKG

tils-first-weather-widget

Version:

An example development EXB widget (Grant Caroll, spatial-innovation.co.nz)

181 lines (136 loc) 3.48 kB
import Accessor from "@arcgis/core/core/Accessor.js"; import { property } from "@arcgis/core/core/accessorSupport/decorators.js"; // import { IAirQuality } from "./air-quality"; import { IWeather } from "./weather"; import { IWeatherCondition } from "./weather-condition"; export interface IForecastHour extends IWeather { time_epoch: number; time: string; windchill_c: number; windchill_f: number; heatindex_c: number; heatindex_f: number; dewpoint_c: number; dewpoint_f: number; will_it_rain: number; chance_of_rain: number; will_it_snow: number; chance_of_snow: number; } export default class ForecastHour extends Accessor implements IForecastHour { @property() time_epoch: number; @property() time: string; @property() windchill_c: number; @property() windchill_f: number; @property() heatindex_c: number; @property() heatindex_f: number; @property() dewpoint_c: number; @property() dewpoint_f: number; @property() will_it_rain: number; @property() chance_of_rain: number; @property() will_it_snow: number; @property() chance_of_snow: number; // @property() // last_updated_epoch: number; // @property() // last_updated: string; @property() temp_c: number; @property() temp_f: number; @property() is_day: number; @property() condition: IWeatherCondition; @property() wind_mph: number; @property() wind_kph: number; @property() wind_degree: number; @property() wind_dir: string; @property() pressure_mb: number; @property() pressure_in: number; @property() precip_mm: number; @property() precip_in: number; @property() humidity: number; @property() cloud: number; @property() feelslike_c: number; @property() feelslike_f: number; @property() vis_km: number; @property() vis_miles: number; @property() uv: number; @property() gust_mph: number; @property() gust_kph: number; // @property() // air_quality: IAirQuality; @property() hour: string; constructor(params: IForecastHour) { super(); console.log(params) this.time_epoch = params.time_epoch; this.time = params.time; this.windchill_c = params.windchill_c; this.windchill_f = params.windchill_f; this.heatindex_c = params.heatindex_c; this.heatindex_f = params.heatindex_f; this.dewpoint_c = params.dewpoint_c; this.dewpoint_f = params.dewpoint_f; this.will_it_rain = params.will_it_rain; this.chance_of_rain = params.chance_of_rain; this.will_it_snow = params.will_it_snow; this.chance_of_snow = params.chance_of_snow; // this.last_updated_epoch = params.last_updated_epoch; // this.last_updated = params.last_updated; this.temp_c = params.temp_c; this.temp_f = params.temp_f; this.is_day = params.is_day; this.condition = params.condition; this.wind_mph = params.wind_mph this.wind_kph = params.wind_kph this.wind_degree = params.wind_degree this.wind_dir = params.wind_dir this.pressure_mb = params.pressure_mb; this.pressure_in = params.pressure_in; this.precip_mm = params.precip_mm; this.precip_in = params.precip_in; this.humidity = params.humidity; this.cloud = params.cloud; this.feelslike_c = params.feelslike_c; this.feelslike_f = params.feelslike_f; this.vis_km = params.vis_km; this.vis_miles = params.vis_miles; this.uv = params.uv; this.gust_mph = params.gust_mph; this.gust_kph = params.gust_kph; // this.air_quality = params.air_quality; this.hour = params.time;//.split(' ')[1].substring(0, 2); } }