@C-son said in Use Javascript to modify the module header:
this.data.header = ‘My header is awesome’;
Thanks
@C-son said in Use Javascript to modify the module header:
this.data.header = ‘My header is awesome’;
Thanks
I could set the header name in config.json
but I would like to modify the value in runtime. So I wonder if I could modify the header using Javascript.
Thanks in advance
My modules would like to support multiple languages (e.g. zh-hk and zh-tw). But actually both language uses the same set of language (Traditional Chinese).
I could support both language in the following function:
getTranslations: function () {
return {
...
"zh-hk": "translations/zh-tw.json"
"zh-tw": "translations/zh-tw.json"
};
Is it possible that I could pre-map zh-hk
to zh-tw
so that I only need to keepzh-tw
in getTranslations
?
The API also returned the localized value based on the language parameters. Therefore I would like to convert zh-hk
and zh-tw
into zh-hant
required by the API (in two different lines). Currently I am doing the conversion in a hard-code way. Is it possible that I could pre-map zh-hk
to zh-tw
so that I could translatezh-tw
into zh-hant
in the API code?
@sdetweil I read this article it gives me some hope that I could add some TS support in the existing module.
Thanks
Thanks @sdetweil
As there are some TS support added 2 years ago (and I am not sure how much TS support is added), therefore I have this question.
Yes the browser support on Nullish coalescing operator started half year back but I need the operator on the backend code (which is the node part). I wonder if I could add some npm modules to make it happen.
@henrikra I am not sure if it is appropriate but I would like to use Nullish coalescing operator.
Is it supported in native MagicMirror? Thanks
My module would import other people’s code, which include Nullish coalescing operator. When I run the code it gives me error.
I would like to know how could I add Nullish coalescing operator support, which is in Typescript 3.7?
Thanks in advnace
Sorry just find that config.language
solves the problem
I am developing a module that need to send the translation via the API. (e.g. /api?lang=en). In order for this I need to obtain the translation from the configuration and send it over.
this.translate
would translate the word and getTranslations
would let the system know where the configuration file is. But I have no luck getting the language setting from config.js
.
Thanks for the help.
I have created a module that would display Estimated Time of Arrival (ETA) in Hong Kong. The tough thing would be there are multiple route will stop at one bus stop, and I need to find the URL for each route. So my program will have several parts.
At load time, it will generate URL for each route
It will load all the routes that will go through that bus stop
Then for each route I need to find the corresponding URL for each route
For each route it will find out the corresponding ETA URL
For each ETA URL, it will poll every minute and update the info in Magic Mirror
But there are few problems here.
I would like to update the ETA URL “Every 5am”, how the schedule can be done?
Currently my work only support one bus stop but I would like to include multiple bus stops, how could I change the structure in node_helper.js to accommodate that?
Thanks in advance