package.utils.createSubscription.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
{"version":3,"file":"createSubscription.js","names":["createConsumer","buildUrl","getWebsocketURL","_document$querySelect","websocketURL","document","querySelector","content","subdomain","globalProps","organization","consumer","createSubscription","channelName","callbacks","subscriptions","create"],"sources":["../../src/utils/createSubscription.js"],"sourcesContent":["import { createConsumer } from \"@rails/actioncable\";\nimport { buildUrl } from \"utils/general\";\n\nconst getWebsocketURL = () => {\n const websocketURL = document.querySelector(\n 'meta[name=\"action-cable-url\"]'\n )?.content;\n\n return buildUrl(websocketURL, {\n subdomain: globalProps.organization.subdomain,\n });\n};\n\nconst consumer = createConsumer(getWebsocketURL);\n\nexport const createSubscription = (channelName, callbacks) =>\n consumer.subscriptions.create(channelName, callbacks);\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,oBAAoB;AACnD,SAASC,QAAQ;AAEjB,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAA,EAAS;EAAA,IAAAC,qBAAA;EAC5B,IAAMC,YAAY,IAAAD,qBAAA,GAAGE,QAAQ,CAACC,aAAa,CACzC,+BAA+B,CAChC,cAAAH,qBAAA,uBAFoBA,qBAAA,CAElBI,OAAO;EAEV,OAAON,QAAQ,CAACG,YAAY,EAAE;IAC5BI,SAAS,EAAEC,WAAW,CAACC,YAAY,CAACF;EACtC,CAAC,CAAC;AACJ,CAAC;AAED,IAAMG,QAAQ,GAAGX,cAAc,CAACE,eAAe,CAAC;AAEhD,OAAO,IAAMU,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,WAAW,EAAEC,SAAS;EAAA,OACvDH,QAAQ,CAACI,aAAa,CAACC,MAAM,CAACH,WAAW,EAAEC,SAAS,CAAC;AAAA"}