Read the statement by Michael Teeuw here.
Gurus, what is the problem with this code ?
-
When I use this function I got an error and nothing appear on the screen.
/* Magic Mirror Config Sample * * By Michael Teeuw http://michaelteeuw.nl * MIT Licensed. * * For more information how you can configurate this file * See https://github.com/MichMich/MagicMirror#configuration * */ var full = ""; function LoadData() { full = "Hello"; } $( document ).ready(function() { LoadData(); }); var config = { address: "localhost", port: 8080, ipWhitelist: ["192.168.1.9"], language: "en", timeFormat: 24, units: "metric", zoom: 0.85, modules: [ { module: "helloworld", position: "center", config: { text: full } }, ] }; /*************** DO NOT EDIT THE LINE BELOW ***************/ if (typeof module !== "undefined") {module.exports = config;} -
@rsellmer
We don’t knowwhat problemdo you have. How can we imagine? -
What are you trying to do and what isn’t working?
-
I can’t read it when it’s not in a code block? :-0)
-
Ok … I am so sorry about that. It was not easy to understand.
Let me try to explain … I need call a function which is declared into the config.js. However, this is impossible. Nothing appeared on the screen. I did not find any example using a function call. Is it clear ? -
/* Magic Mirror Config Sample * * By Michael Teeuw http://michaelteeuw.nl * MIT Licensed. * * For more information how you can configurate this file * See https://github.com/MichMich/MagicMirror#configuration * */ var full = ""; function LoadData() { full = "Hello"; } $( document ).ready(function() { LoadData(); }); var config = { address: "localhost", port: 8080, ipWhitelist: ["192.168.1.9"], language: "en", timeFormat: 24, units: "metric", zoom: 0.85, modules: [ { module: "helloworld", position: "center", config: { text: full } }, ] }; /*************** DO NOT EDIT THE LINE BELOW ***************/ if (typeof module !== "undefined") {module.exports = config;} -
@rsellmer
As I’ve written in your other post, jQuery is not included as a default. You did a try to use jQuery($(document).ready()) -
@sean Tks again … I am newb with MM, so I think that it is not possible to create a function in the config.js … I think that this will not work. because the next step I will need to call an api from config.js to get some data from mysql.
In my test using a config.js out the MM system, I could call the api, but I think that this is not possible in the MM. Am I right ? Tks -
@rsellmer
config.jsis not for your custom job. leave it.
When you want to do something your own, createmodule.
Read the manual.And see how other modules work;
You can start by modifying any simple module as your wish.
-
@rsellmer
one more thing;
config.jsis validated when MM is booted up, not rendered. maybe you can put some codes inconfig.jsbut that would not be working as your expectation.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login