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 window.$http = httpInstance;
13 window.$events = events;
16 // Creates a global function with name 'trans' to be used in the same way as Laravel's translation system
17 import Translations from "./services/translations"
18 const translator = new Translations();
19 window.trans = translator.get.bind(translator);
20 window.trans_choice = translator.getPlural.bind(translator);
21 window.trans_plural = translator.parsePlural.bind(translator);
24 import components from "./components"