What is the exact startup order of a module?
What is processed first and how can I learn/understand the process?
Read the statement by Michael Teeuw here.
Posts
-
What is the startup order in a Module with node_helper.js?
-
What is the difference between require() and getScripts()?
I’ve been trying to implement the jquery dependent package (
Tabulator) on my mirror. What it does is, convert JSON data into a nice dynamic HTML table.In the working HTML version, I just the
scripttag, to include everything, but in a Node MMM, we can either userequire("blablah")in thenode_helper.jsfile, or usegetScripts("blablah.js")in theMMM-MyModule.jsfile.- What is the difference?
- When to use what?
Right now I’m using the 2nd option, and it loads, but the table is never shown… I’m thinking I’m missing something.
-
RE: I got sucked up into a magic mirror! (and need some help)
@raywo Great! Thanks! I just answered…
What’s next? Well, the table never get shown, so fixing that is next.
Once all this demo works, it’s time to put it all into a module that is actually doing something. -
RE: Adding jQuery
@ninjabreadman Oh man, Excellent! I wish I’d had seen that a week ago…
Anyway, I’ve solved it since, but got another issue with getting the
Tabulatorcode to actually do something. No errors shown, unfortunately.PS. Is there a way to close a thread or mark it as solved??
-
RE: MMM-Tabulator: How to port HTML JS imports to node JS imports? [solved]
@ninjabreadman Thank you very much for trying to help. But I’m pretty sure I tried that as well…at some point, giving me a “double” path. (Perhaps a browser cache issue?).
Anyway, this is resolved, and I have a new problem of a completely different sort in this thread.
-
RE: I got sucked up into a magic mirror! (and need some help)
@raywo Hi Thank you fo r taking your time to look at this. I have now updated the code.
It runs and I created a newloadTabulatefunction, that is supposed to do exactly the same as in thedemo.htmlfile…it returns, but nothing is displayed. I don’t know how to debug this, since there are no errors.Perhaps, I just doing this Tabulator inclusion all wrong. I have no idea how to proceed at this point.
-
RE: I got sucked up into a magic mirror! (and need some help)
Your MMM look very nice and the code is indeed very clean, although quite different from what I’ve seen so far. However, I’m looking at this as an exercise, since it’s my first Module.
So yes, using jquery + add-ons are definitely overkill, but has not yet been done before AFAICT. As you can see, in the
demo.html, it makes doing fantastic tables using JSON a super breeze (obviously at the cost of external code and processing bloat). So since I hate making DOM from JS, I rather prefer using tools available, even if it means all this extra work and hair-pulling.I’ll soon update the repo code in the signature, once I get the table up.
-
RE: I got sucked up into a magic mirror! (and need some help)
I’ve solved one of the problems with the
blocked due to MIME type mismatcherror above, in this thread. Please look at that answer to import your external jquery related scripts. -
RE: MMM-Tabulator: How to port HTML JS imports to node JS imports? [solved]
@raywo Hi! Yeah, that worked! Thank you! I was going really crazy here…
Anything other than what’s shown below, results in an error as mentioned above.
Apparently the only types of paths that work, are the following (including the out-commented ones):getScripts: function() { // return ["moment.js"]; return [ this.file('node_modules/jquery/dist/jquery.min.js'), this.file('node_modules/jquery-ui-dist/jquery-ui.min.js'), this.file('node_modules/jquery.tabulator/dist/js/tabulator.js') // 'modules/MMM-Tabulator/node_modules/jquery/dist/jquery.min.js', // 'modules/MMM-Tabulator/node_modules/jquery-ui-dist/jquery-ui.min.js', // 'modules/MMM-Tabulator/node_modules/jquery.tabulator/dist/js/tabulator.js' ] }, getStyles: function() { return [ this.file('node_modules/jquery-ui-dist/jquery-ui.css'), this.file('node_modules/jquery.tabulator/dist/css/tabulator.css'), "MMM-Tabulator.css" ]; },That took considerable trial-and-error, as this is not at all apparent from the documentation. At least not how I interpret it. (I was clearly under the incredibly naive impression that MM would search the file tree in
node_modulesdirectory and elsewhere, looking for the file names specified.) -
RE: Adding jQuery
@strawberry-3-141
It seem that getscripts doesn’t work anymore, at least not as I expected. This seem to be because even though MM finds the script, we get hit by the security error:
The resource from “http://192.168.1.2:8080/node_modules/jquery-ui-dist/jquery-ui.css” was blocked due to MIME type mismatch (X-Content-Type-Options: nosniff).Any idea how to get past this?
-
RE: I got sucked up into a magic mirror! (and need some help)
Anyone can give some hints?
-
RE: MMM-Tabulator: How to port HTML JS imports to node JS imports? [solved]
Is there really nobody who knows how to import a CSS stylesheet from a
./node_modules/installed package?The package(s) in question are
jquery,jquery-ui, and were installed with:npm install jquery --savein my module directory. -
RE: How can I show a borderless (Bash) shell terminal window on top of MM?
@ninjabreadman Hi! Thanks, I knew about that, but was hoping to use the default
lxterminal, but unfortunately it only allows--geometry=CHARACTERSxLINESas option.Your solution of using rxvt-unicode seem pretty good as it supports 256 colors etc. However, in the end, I decided that I’d rather have a native MMM, than just throwing a window on top of everything. That complicates things though. I simply don’t see how to go about implementing the JS version of xterm into a Module. Perhaps something to suggest in the requests area?
Anyway, could be useful for all those people and command-line junkies, who want to see their raw python output.
-
RE: Module Developer Challenge - I surrender!
@Mykle1 I love seeing all the progress and work you put into your module development. I must say, as an old time computer fanatic, I’m very impressed with your progress. I’m totally new to MM and still find the node/electron/express framework a rather challenging learning experience. I’ve done some fair amount of rather advanced R&D and bare-metal programming and hacking, and never expected that something based on JS, would be the thing to slow me down! Boy was I wrong and full respect to all those dev’s here, who are able to produce such nice work. I guess it again proves that technical skills without creativity is useless.
As for the Module, IMHO each individual core Temp is not a very interesting parameter, because of load-balancing. Unless you have a faulty core or are explicitly telling your machine to be running certain processes on a single core. In addition, because of how heat is distributed rather evenly throughout the chip dye, you’d never see much difference than a few degrees, so I would rather average the core temps into one, and possibly show the divergence of them. (I.e. the greatest % difference from the average.)
-
RE: MMM-cryptocurrency - v1.4
@bocapie File an issue and ask the repo owner, he’s really friendly and helpful.
-
RE: MMM-cryptocurrency - v1.4
@fox Yes, and from the GH issue I filed, he added the first 100 coins, its easily scriptable to add all.
-
RE: Module Developer Challenge - I surrender!
@Mykle1 Not sure what you’re doing in your code. But…
- You’ll get a temp reading for each cpu core, so you need to choose|add|average…, and
- How do you execute the script? Did you give it proper permissions?
- I’m you already know, but you also need to allow the external file to be read from node_helper.js.
-
RE: IFrame
@maxbachmann What does your browser’s Developer Tools log say?
-
RE: Display values from a JSON file hosted online
@yawns Was that re-load issue ever resolved? I have my own basic issues and I’m considering using this code instead…