javascripts/pushr/index.js

  1. /**
  2. * @namespace javascripts.pushr.index
  3. * @description Create a public interface for sending events and sets up event listeners.
  4. */
  5. import { pushrDispatchers, eventListenerDispatchers } from "~/javascripts/pushr/dispatchers"
  6. const publicInterface = {
  7. /**
  8. * Forwards the sent data onto dispatchers that will handle the events.
  9. *
  10. * @function log
  11. * @memberof javascripts.pushr.index
  12. */
  13. log: (pushrObject) => {
  14. pushrDispatchers(pushrObject)
  15. }
  16. }
  17. /**
  18. * Create a public interface for sending events and sets up event listeners.
  19. *
  20. * @function pushrInit
  21. * @memberof javascripts.pushr.index
  22. */
  23. export const pushrInit = () => {
  24. eventListenerDispatchers()
  25. window.pushr = publicInterface
  26. }