package.cjs.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":["_actioncable","require","_general","getWebsocketURL","_document$querySelect","websocketURL","document","querySelector","content","buildUrl","subdomain","globalProps","organization","consumer","createConsumer","createSubscription","channelName","callbacks","subscriptions","create","exports"],"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,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAME,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,OAAO,IAAAC,iBAAQ,EAACJ,YAAY,EAAE;IAC5BK,SAAS,EAAEC,WAAW,CAACC,YAAY,CAACF;EACtC,CAAC,CAAC;AACJ,CAAC;AAED,IAAMG,QAAQ,GAAG,IAAAC,2BAAc,EAACX,eAAe,CAAC;AAEzC,IAAMY,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,WAAW,EAAEC,SAAS;EAAA,OACvDJ,QAAQ,CAACK,aAAa,CAACC,MAAM,CAACH,WAAW,EAAEC,SAAS,CAAC;AAAA;AAACG,OAAA,CAAAL,kBAAA,GAAAA,kBAAA"}