Framework.js as module for import to work?

Hello, what's the proper way to make callbacks I define in framework.js communicate with my own project?

I thought I could use my app's VueJS event bus feature ( Using event bus in Vue.js to pass data between components - LogRocket Blog

Basically, a VueJS instance is created and can emit and receive events anywhere in my application.

Thus, I would need this in framework.js:

import Vue from 'vue'

window.Framework = {
  config: {
// ... my config
},

  initialSetup: function () {
    window.PureCloud.subscribe([
      {
        type: "Interaction",
        categories: ["connect", "disconnect", "change"],
        callback: function (category, data) {
        //  ... some conditions
        // use the Vue event bus and send a message with data from received interaction
 
              Vue.prototype.$inMemoryEventsHub.$emit('genesys-interaction-received', {id: data.new.id, phoneNumber: data.new.phone, startTime: data.new.startTime, language: data.new.attributes.language, zipCode: data.new.attributes.zipCode, queueName: data.new.queueName})
            }
        }
      },
...

Is it possible to make it work? It seems that using (private cloud hosted) framework.js as "script type='module'" would solve it. Thanks for guidance.

Helping myself, window.postMessage() is the way to go.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.