In my exemple, i have just one function and I call it in phtml on passing the name function as param require(['jquery', 'module'], function($, hello) and it works fine.
Now if i want to return 10 functions for exemple, what is the best way to do that.
Did
depsattributedeps: ["js/go"]is correct for that instead ofmapI wonder if there is not a way to implemente some js libraire, ie we have to put the lib js content in a file js then we declare it in a some module then the lib content will automatically be rendered without calling all functions one by one.
app/code/Vendor/Module/view/frontend/requirejs-config.js
var config = {
map: {
'*': {
module: 'Vendor_module/js/go',
}
}
};
app/code/Vendor/Module/view/frontend/web/js/go.js
define(['jquery'], function($){
"use strict";
return function hello()
{
alert('hello from function');
}
public function f1()
{
...
}
public function f2()
{
...
}
...
});
app/code/Vendor/Module/view/frontend/templates/file.phtml
<script type="text/javascript">
require(['jquery', 'module'], function($, hello) {
hello();
});
</script>


.jsof local function declerations.