Using functions from other Javascript files in app.js

Hello,

Is there a way to move some of my functions from app.js to another file to make my code more organized?
From what I have tested you can not use import/export keywords in frontend code. In some older example apps like this some functions were just defined in other files e.g. showNotify in util.js and then called without any import in app.js.

When I try to do the same I get an error that the function is not defined.

Hi @chrism,

In the sample app, the two JS files (scripts/app.js and scripts/util.js) are imported in the HTML file (template/index.html). The browser will include all the JavaScript files that are included with the script tag in the HTML file rendered.

The app essentially renders the configured HTML file in the manifest.json for each placeholder. So, the same HTML file is rendered by the browser with all the included JS files.

Hello @Raviraj,

Thanks for your help, I got it working now.

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.