i programmed two apps which should share js functions which i like to put in a seperate file.
To simplify let's say the apps are app1 and app2.
the first app is located at htdocs/media/com_easysocial/apps/group/app1/themes/default/canvas/default.js
and the code looks like
EasySocial.require()
.library('ui/datepicker')
.done(function($) {
function f1(date){
fDate = $.datepicker.formatDate("YY-mm-dd", date);
return fDate;
}
})
the second app is located at htdocs/media/com_easysocial/apps/group/app1/themes/default/canvas/default.js
an looks like
EasySocial.require()
.library('ui/datepicker')
.done(function($) {
function f1(date){
fDate = $.datepicker.formatDate("YY-mm-dd", date);
return fDate;
}
})
The result should be, that i can call
f1(new Date())
from app1 and app2.
Now i like to have this function (f1) in a file which should be included in both apps so that f1 can be called from both.
Also "ui/datepicker" should be included!
How can i handle this?
Where do i have to put this file?
Should an app have its own folder like htdocs/media/com_easysocial/apps/MY_APPS/app1/themes/... ?