156
Views
6
Comments
Solved
JS Files

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.

2022-08-26 15-30-27
Frederico Pavão
Solution

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).

UserImage.jpg
SEREEN QAMHIEH

Thanks!

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @SEREEN QAMHIEH ,

you could easily just test this out, make a demo app, and inspect what happens with your chrome dev tools.

Dorine

2022-01-13 11-06-04
Neha Sheikh
Champion

Hi Sereen,

It will be loaded just one time. You can check the logs in the demo OML.


Thanks,

Neha

DemoRef.oml
UserImage.jpg
Mafalda Oliveira

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.

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

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?

2022-08-26 15-30-27
Frederico Pavão
Solution

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).

UserImage.jpg
SEREEN QAMHIEH

Thanks!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.