mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-11-30 18:11:44 +00:00
[weatherprovider] update subclass language use override (#3914)
This commit is contained in:
@@ -31,6 +31,7 @@ planned for 2026-01-01
|
||||
- [ci] Add concurrency to automated tests workflow to cancel outdated runs (#3943)
|
||||
- [tests] replace `node-libgpiod` with `serialport` in electron-rebuild workflow (#3945)
|
||||
- [calendar] hide repeatingCountTitle if the event count is zero (#3949)
|
||||
- [weatherprovider] update override warning wording (#3914)
|
||||
- [core] configure cspell to check default modules only and fix typos (#3955)
|
||||
- [core] refactor: replace `XMLHttpRequest` with `fetch` in `translator.js` (#3950)
|
||||
- [tests] migrate e2e tests to Playwright (#3950)
|
||||
|
||||
@@ -275,7 +275,6 @@
|
||||
"Stieber",
|
||||
"strinner",
|
||||
"stylelintrc",
|
||||
"subclassing",
|
||||
"sunaction",
|
||||
"suncalc",
|
||||
"suntimes",
|
||||
|
||||
24
js/module.js
24
js/module.js
@@ -7,9 +7,9 @@
|
||||
const Module = Class.extend({
|
||||
|
||||
/**
|
||||
********************************************************
|
||||
* All methods (and properties) below can be subclassed. *
|
||||
********************************************************
|
||||
*********************************************************
|
||||
* All methods (and properties) below can be overridden. *
|
||||
*********************************************************
|
||||
*/
|
||||
|
||||
// Set the minimum MagicMirror² module version for this module.
|
||||
@@ -75,8 +75,8 @@ const Module = Class.extend({
|
||||
|
||||
/**
|
||||
* Generates the dom which needs to be displayed. This method is called by the MagicMirror² core.
|
||||
* This method can to be subclassed if the module wants to display info on the mirror.
|
||||
* Alternatively, the getTemplate method could be subclassed.
|
||||
* This method can to be overridden if the module wants to display info on the mirror.
|
||||
* Alternatively, the getTemplate method could be overridden.
|
||||
* @returns {HTMLElement|Promise} The dom or a promise with the dom to display.
|
||||
*/
|
||||
getDom () {
|
||||
@@ -109,7 +109,7 @@ const Module = Class.extend({
|
||||
/**
|
||||
* Generates the header string which needs to be displayed if a user has a header configured for this module.
|
||||
* This method is called by the MagicMirror² core, but only if the user has configured a default header for the module.
|
||||
* This method needs to be subclassed if the module wants to display modified headers on the mirror.
|
||||
* This method needs to be overridden if the module wants to display modified headers on the mirror.
|
||||
* @returns {string} The header to display above the header.
|
||||
*/
|
||||
getHeader () {
|
||||
@@ -118,8 +118,8 @@ const Module = Class.extend({
|
||||
|
||||
/**
|
||||
* Returns the template for the module which is used by the default getDom implementation.
|
||||
* This method needs to be subclassed if the module wants to use a template.
|
||||
* It can either return a template sting, or a template filename.
|
||||
* This method needs to be overridden if the module wants to use a template.
|
||||
* It can either return a template string, or a template filename.
|
||||
* If the string ends with '.html' it's considered a file from within the module's folder.
|
||||
* @returns {string} The template string of filename.
|
||||
*/
|
||||
@@ -129,7 +129,7 @@ const Module = Class.extend({
|
||||
|
||||
/**
|
||||
* Returns the data to be used in the template.
|
||||
* This method needs to be subclassed if the module wants to use a custom data.
|
||||
* This method needs to be overridden if the module wants to use a custom data.
|
||||
* @returns {object} The data for the template
|
||||
*/
|
||||
getTemplateData () {
|
||||
@@ -196,9 +196,9 @@ const Module = Class.extend({
|
||||
},
|
||||
|
||||
/**
|
||||
********************************************
|
||||
* The methods below don't need subclassing. *
|
||||
********************************************
|
||||
***********************************************
|
||||
* The methods below should not be overridden. *
|
||||
***********************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,19 +42,19 @@ const WeatherProvider = Class.extend({
|
||||
// This method should start the API request to fetch the current weather.
|
||||
// This method should definitely be overwritten in the provider.
|
||||
fetchCurrentWeather () {
|
||||
Log.warn(`[weatherprovider] ${this.providerName} does not subclass the fetchCurrentWeather method.`);
|
||||
Log.warn(`[weatherprovider] ${this.providerName} does not override the fetchCurrentWeather method.`);
|
||||
},
|
||||
|
||||
// This method should start the API request to fetch the weather forecast.
|
||||
// This method should definitely be overwritten in the provider.
|
||||
fetchWeatherForecast () {
|
||||
Log.warn(`[weatherprovider] ${this.providerName} does not subclass the fetchWeatherForecast method.`);
|
||||
Log.warn(`[weatherprovider] ${this.providerName} does not override the fetchWeatherForecast method.`);
|
||||
},
|
||||
|
||||
// This method should start the API request to fetch the weather hourly.
|
||||
// This method should definitely be overwritten in the provider.
|
||||
fetchWeatherHourly () {
|
||||
Log.warn(`[weatherprovider] ${this.providerName} does not subclass the fetchWeatherHourly method.`);
|
||||
Log.warn(`[weatherprovider] ${this.providerName} does not override the fetchWeatherHourly method.`);
|
||||
},
|
||||
|
||||
// This returns a WeatherDay object for the current weather.
|
||||
|
||||
Reference in New Issue
Block a user