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