mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Add JSDoc description
This commit is contained in:
parent
0f39b7733c
commit
1d90c5e1fe
@ -155,7 +155,7 @@ Module.register("weather", {
|
|||||||
this.sendNotification("CURRENTWEATHER_TYPE", { type: this.weatherProvider.currentWeather().weatherType.replace("-", "_") });
|
this.sendNotification("CURRENTWEATHER_TYPE", { type: this.weatherProvider.currentWeather().weatherType.replace("-", "_") });
|
||||||
}
|
}
|
||||||
|
|
||||||
let notificationPayload = {
|
const notificationPayload = {
|
||||||
currentWeather: this.weatherProvider?.currentWeatherObject?.simpleClone() ?? null,
|
currentWeather: this.weatherProvider?.currentWeatherObject?.simpleClone() ?? null,
|
||||||
forecastArray: this.weatherProvider?.weatherForecastArray?.map((ar) => ar.simpleClone()) ?? [],
|
forecastArray: this.weatherProvider?.weatherForecastArray?.map((ar) => ar.simpleClone()) ?? [],
|
||||||
hourlyArray: this.weatherProvider?.weatherHourlyArray?.map((ar) => ar.simpleClone()) ?? [],
|
hourlyArray: this.weatherProvider?.weatherHourlyArray?.map((ar) => ar.simpleClone()) ?? [],
|
||||||
|
@ -148,9 +148,12 @@ class WeatherObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone to simple object to prevent mutating and deprecated legacy library.
|
* Clone to simple object to prevent mutating and deprecation of legacy library.
|
||||||
*
|
*
|
||||||
* @returns {object} simple object cloned.
|
* Before being handed to other modules, mutable values must be cloned safely.
|
||||||
|
* Especially 'moment' object is not immutable, so original 'date', 'sunrise', 'sunset' could be corrupted or changed by other modules.
|
||||||
|
*
|
||||||
|
* @returns {object} plained object clone of original weatherObject
|
||||||
*/
|
*/
|
||||||
simpleClone() {
|
simpleClone() {
|
||||||
const toFlat = ["date", "sunrise", "sunset"];
|
const toFlat = ["date", "sunrise", "sunset"];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user