bootstrap.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. window._ = require('lodash');
  2. /**
  3. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  4. * for JavaScript based Bootstrap features such as modals and tabs. This
  5. * code may be modified to fit the specific needs of your application.
  6. */
  7. try {
  8. window.Popper = require('popper.js').default;
  9. window.$ = window.jQuery = require('jquery');
  10. window.$.cookie=require('js-cookie')
  11. require('bootstrap');
  12. } catch (e) {}
  13. window.moment = require('moment');
  14. /**
  15. * We'll load the axios HTTP library which allows us to easily issue requests
  16. * to our Laravel back-end. This library automatically handles sending the
  17. * CSRF token as a header based on the value of the "XSRF" token cookie.
  18. */
  19. window.axios = require('axios');
  20. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  21. /**
  22. * Next we will register the CSRF Token as a common header with Axios so that
  23. * all outgoing HTTP requests automatically have it attached. This is just
  24. * a simple convenience so we don't have to attach every token manually.
  25. */
  26. let token = document.head.querySelector('meta[name="csrf-token"]');
  27. if (token) {
  28. window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  29. } else {
  30. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  31. }
  32. /**
  33. * Echo exposes an expressive API for subscribing to channels and listening
  34. * for events that are broadcast by Laravel. Echo and event broadcasting
  35. * allows your team to easily build robust real-time web applications.
  36. */
  37. import Echo from 'laravel-echo'
  38. //
  39. // const client = require('pusher-js');
  40. window.io = require('socket.io-client');
  41. window.initEcho=function(){
  42. window.Echo = new Echo({
  43. broadcaster: 'socket.io',
  44. host: window.location.hostname + ':6001',
  45. //broadcaster: 'pusher',
  46. // key: process.env.MIX_PUSHER_APP_KEY,
  47. // key: 'bo20alg-1',
  48. // authEndpoint: '/custom/endpoint/auth',
  49. // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
  50. // encrypted: true,
  51. // client:client
  52. });
  53. };