Skip to content

Commit f3e3603

Browse files
fix: remove global data variable to prevent instance conflicts
- Remove global let data declaration - Pass data as parameter to processOnecall() - Use local const in socketNotificationReceived
1 parent ff71900 commit f3e3603

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

MMM-OneCallWeather.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
let data;
2-
31
Module.register("MMM-OneCallWeather", {
42
defaults: {
53
latitude: false,
@@ -109,15 +107,15 @@ Module.register("MMM-OneCallWeather", {
109107
socketNotificationReceived(notification, payload) {
110108
if (notification === "OPENWEATHER_ONECALL_DATA" && payload.identifier === this.identifier) {
111109
// process weather data
112-
({ data } = payload);
110+
const { data } = payload;
113111
this.forecast = this.processOnecall(data);
114112
this.loaded = true;
115113
this.updateDom();
116114
this.scheduleUpdate();
117115
}
118116
},
119117

120-
processOnecall() {
118+
processOnecall(data) {
121119
let wsfactor = 2.237;
122120
const current = [];
123121
if (this.config.windUnits === "kmph") {

0 commit comments

Comments
 (0)