Skip to content

Commit 274fe40

Browse files
author
Ryan Burns
committed
1.0.0-alpha.2:
- Add number type support for query property - dispatch data-changed event
1 parent c0d900e commit 274fe40

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changelog
2+
3+
## [1.0.0-alpha.2] - 2020-03-11
4+
- Add number type support for query property
5+
- dispatch data-changed event
6+
7+
## [1.0.0-alpha.1] - 2020-03-10
8+
- Initial commit

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lit-weather",
3-
"version": "0.0.1",
3+
"version": "1.0.0-alpha.2",
44
"description": "lit-weather is a web component using lit-html to display current weather and a forecast with the openWeather apis",
55
"author": "lit-weather",
66
"license": "MIT",

src/LitWeather.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,8 @@ export class LitWeather extends LitElement {
379379
// eslint-disable-next-line class-methods-use-this
380380
_getLocationParam(query) {
381381
// eslint-disable-next-line no-restricted-globals
382-
const isZipCode = !isNaN(query.charAt(0) - parseFloat(query.charAt(0)));
382+
const firstChar = query.toString().charAt(0);
383+
const isZipCode = !isNaN(firstChar - parseFloat(firstChar));
383384
return isZipCode ? `zip=${query}` : `q=${query}`;
384385
}
385386

@@ -408,6 +409,7 @@ export class LitWeather extends LitElement {
408409
}),
409410
fullForecastUrl: `https://openweathermap.org/city/${data.id}`,
410411
};
412+
this.dispatchEvent(new CustomEvent('data-changed', { detail: { value: this.data } }));
411413
})
412414
.catch(error => {
413415
this._handleWeatherError(error);

0 commit comments

Comments
 (0)