Read the statement by Michael Teeuw here.
Adding a jQuery Module
-
@NiviJah i think the document ready is fired before the modules are loaded (didn’t test it) there is a broadcast of the core called
DOM_OBJECTS_CREATED
if you’re using console.log or Log.info it will be in the electron console, you can see the console by starting the mirror via npm start dev
electron is based on chromium prefix would be
-webkit
If you tell for what you want to use jquery, we can help you to do it in vanilla javascript
-
In addition to @strawberry-3.141 response. I wanted to chime in with option of running it locally on your dev machine and using
node serveronly
and pointing your browser athttp://localhost:8080
using familiar tools while developing. One of the catches is it will not work well if you are developing module that needs to interact with GPIO or other proprietary RasPi functionality.My personal workflow is roughly outlined here: https://forum.magicmirror.builders/post/13272
-
Thank you,
This is very helpful.
If I understand correctly, do I need to useDOM_OBJECTS_CREATED
like this ?notificationReceived: function(notification, payload, sender){ if (notification === 'DOM_OBJECTS_CREATED'){ $(document).ready()..... } },
Does that go into my plugin file ? (i.e not the node helper)
-
@NiviJah your Code example is correct, except that you don’t Need the ready function, at this Point the Dom is ready and you can do whatever You Wanted to without wrapping it into another event
-
jQuery didn’t want to play nice, i don’t know why, so I had to work with Vanilla JS.
here is the result
-
@NiviJah Did you get jQuery to run at all?