LazyLoad Widgets

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


<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



 <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?

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?

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?

Then, try this:


window._genesys.widgets.onReady = function(bus) {
    bus.command("Webchat.open");
}

Yes! that made it! Thanks! Was using the doc one but was getting an error…thanks!