Author Topic: LazyLoad Widgets  (Read 670 times)

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7171
  • Karma: 56330
LazyLoad Widgets
« on: August 20, 2019, 04:17:02 AM »
Hi guys
I am trying to make a sample for the new Widgets and trying to understand this LazyLoad method.
I added and modified the script provided at the docs
Code: [Select]
<script src="widgets/cxbus.min.js" onload="javascript:CXBus.configure({debug:true,pluginsPath:'plugins/'});CXBus.loadFile('widgets.config.js').done(function(){CXBus.loadPlugin('widgets-core')});"></script>


So at widgets.config.js I put the launcher.html output.
Also added the script
Code: [Select]

 <script>
 
        if(!window._genesys)window._genesys = {};
        if(!window._gt)window._gt = [];
 
        window._genesys.widgets = {
 
                main: {},
                webchat: {}

        };
 


Before everything else.
Yet, doesn't seems to work...any clue what I may be missing or how does this is supposed to work?


Offline jamesmurphyau

  • Full Member
  • ***
  • Posts: 117
  • Karma: 2
Re: LazyLoad Widgets
« Reply #1 on: August 20, 2019, 11:36:14 AM »
Where are your plugins located? Are the in /widgets/plugins or are they in /plugins?

If they are located at /widgets/plugins then you need to update your pluginsPath.

My folder structure looks like:

js/cxbus.min.ja
js/plugins/widgets-core.min.js
js/plugins/webchat.min.js

and in this case, I set the plugins path to js/plugins/

Are there any errors in the developer tools console on Google Chrome?

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7171
  • Karma: 56330
Re: LazyLoad Widgets
« Reply #2 on: August 20, 2019, 11:25:50 PM »
No erros, I see at console that everythings loads up correctly. What I think is missing how to call the webchat open API...is it supposed to be there or need to add some extra code?

Offline hsujdik

  • Sr. Member
  • ****
  • Posts: 377
  • Karma: 15
    • Genesys Brasil
Re: LazyLoad Widgets
« Reply #3 on: August 20, 2019, 11:44:12 PM »
Then, try this:

Code: [Select]
window._genesys.widgets.onReady = function(bus) {
    bus.command("Webchat.open");
}

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7171
  • Karma: 56330
Re: LazyLoad Widgets
« Reply #4 on: August 21, 2019, 01:52:44 AM »
Yes! that made it! Thanks! Was using the doc one but was getting an error...thanks!