2 import "./services/dom-polyfills"
4 // Url retrieval function
5 window.baseUrl = function(path) {
6 let basePath = document.querySelector('meta[name="base-url"]').getAttribute('content');
7 if (basePath[basePath.length-1] === '/') basePath = basePath.slice(0, basePath.length-1);
8 if (path[0] === '/') path = path.slice(1);
9 return basePath + '/' + path;
12 // Set events and http services on window
13 import Events from "./services/events"
14 import Http from "./services/http"
15 let httpInstance = Http();
16 window.$http = httpInstance;
17 window.$events = new Events();
20 // Creates a global function with name 'trans' to be used in the same way as Laravel's translation system
21 import Translations from "./services/translations"
22 let translator = new Translations(window.translations);
23 window.trans = translator.get.bind(translator);
24 window.trans_choice = translator.getPlural.bind(translator);
26 // Load in global UI helpers and libraries including jQuery
27 import "./services/global-ui"
29 // Set services on Vue
31 Vue.prototype.$http = httpInstance;
32 Vue.prototype.$events = window.$events;
34 // Load vues and components
35 import vues from "./vues/vues"
36 import components from "./components"