Hello,I want to ask if I have a block with an action that have JS node and the block is placed inside a screen, when it's published how many JS files will be loaded ? (0, one file for the block, two files for the block and screen, three files for the block screen and module) , noting there is no required JS files in the Module ,screen or block.
Hi @SEREEN QAMHIEH.Each important app element has its own javascript file. Those files are used to run javascript code that is written inside js nodes in client side action flows:
Module ([ModuleName].controller.js): javascript code from js nodes inside global client actions is merged into this file
Screen ([ModuleName].[FlowName].[ScreenName].mvc.js): javascript code from js nodes inside screen actions is merged into this file
Block ([ModuleName].[FlowName].[BlockName].mvc.js): javascript code from js nodes inside block client actions is merged into this file
Javascript logic nodes never create a standalone file to run the code inside the node.
So, to answer, a block inside a screen will generate 2 javascript files. The controller for the screen, and the controller for the block(assuming we are not counting the module file, which is always there).
Thanks!
Hi @SEREEN QAMHIEH ,
you could easily just test this out, make a demo app, and inspect what happens with your chrome dev tools.
Dorine
Hi Sereen,
It will be loaded just one time. You can check the logs in the demo OML.
Thanks,
Neha
Hello Sereen!
JavaScript is typically bundled and minified into the existing JS files that are loaded with the screen. So there will be one JS file loaded, which includes the JS from the block's action, assuming that there are no other JS dependencies in the module, screen, or block.
This is not true. OutSystems does unfortunately not minify and bundle javascript files.
Only the different javascript nodes in a screen or a block end up in a file per screen or block.
How did you conclude this?