Does Node-RED support features like window.onload?

Thank you for reading the question.

I try to import the css and js files by modifying the mst files on the Node-RED.

The css file works normally, but the js file has problems with the order of execution.

In the js file, some HTML of the Node-RED is modified using jQuery.

So I want to know a function about situations where all dashboards are loaded to modify HTML with jQuery. (A function like window.onload, document.onload)

I have confirmed that it can be implemented using js and HTML of that node by creating a node, but I want to know how to modify the mst, not how to install the node.

Do you mean the index.mst file that is part of the @node-red/editor-client module?

If you want to customise the editor, the first thing to look at is using the editorTheme setting in your settings file which allows you to add custom javascript and css files that will get loaded by the editor.

However you chose to do it, then any code you add to index.mst or the script via editorTheme, will get run in the browser - so you'll have full access to all the standard browser apis like window.onload.

As we provide jQuery in the editor, you can also do:

$(function() {
   // Code is run when the page has finished loading
});
1 Like

Thank you for kindly answering the gibberish question.