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