Using a Headless Widget

Description

A headless widget is a widget that allows access to all of its methods but does not render its UI.

The "headless" behavior of a widget is dictated by the headless property, which default value is "false", and when set to "true" will return a widget of type "headless".

Example

<script defer src="https://cdn.jelou.ai/widgets/loader.js"></script>
<script>
    document.addEventListener('jelou-widget:load', () => {
        const widgetService = new WidgetService({ 
            apiKey: '<apiKey>',
            properties: { headless: true },
        });
        widgetService.connect({ }).then((instance) => {
	    console.log('Success! 🚀');
	    instance.on("message", (data) => {
                alert(JSON.stringify(data, null, 2));
            });
        });
    });
</script>

Last updated