1 // Url retrieval function
2 window.baseUrl = function(path) {
3 let basePath = document.querySelector('meta[name="base-url"]').getAttribute('content');
4 if (basePath[basePath.length-1] === '/') basePath = basePath.slice(0, basePath.length-1);
5 if (path[0] === '/') path = path.slice(1);
6 return basePath + '/' + path;
9 // Set events and http services on window
10 import Events from "./services/events"
11 import httpInstance from "./services/http"
12 const eventManager = new Events();
13 window.$http = httpInstance;
14 window.$events = eventManager;
17 // Creates a global function with name 'trans' to be used in the same way as Laravel's translation system
18 import Translations from "./services/translations"
19 const translator = new Translations();
20 window.trans = translator.get.bind(translator);
21 window.trans_choice = translator.getPlural.bind(translator);
23 // Make services available to Vue instances
25 Vue.prototype.$http = httpInstance;
26 Vue.prototype.$events = eventManager;
28 // Load Vues and components
29 import vues from "./vues/vues"
30 import components from "./components"