tils-first-weather-widget
Version:
An example development EXB widget (Grant Caroll, spatial-innovation.co.nz)
181 lines (136 loc) • 3.48 kB
text/typescript
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 {
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;
// @property()
// last_updated_epoch: number;
// @property()
// last_updated: string;
temp_c: number;
temp_f: number;
is_day: number;
condition: IWeatherCondition;
wind_mph: number;
wind_kph: number;
wind_degree: number;
wind_dir: string;
pressure_mb: number;
pressure_in: number;
precip_mm: number;
precip_in: number;
humidity: number;
cloud: number;
feelslike_c: number;
feelslike_f: number;
vis_km: number;
vis_miles: number;
uv: number;
gust_mph: number;
gust_kph: number;
// @property()
// air_quality: IAirQuality;
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);
}
}