Best Practices & Module Loading Tutorial

Widget Loading with RequireJS

You can load our Chat Widget Loader code with RequireJS, too. It's totally simple and you are able to pass additional options to configure the Widget setup.

The options can be passed as an object to the "load" method. Available options are:

If you use an AMD loader, calling the "load" method is necessary to initialize the Chat Widget.
OptionDescription
avoid_globals: false(default)|trueYou can prevent the api-methods from beeing bound to the window object.
ready: functionYou can pass your own on-ready callback function.
remoteReady: functionYou can pass your own on-remote-ready callback function.
custom_data: objectIf you want to initialize your widget with custom data you can pass your object to the custom_data option.

After loading the Chat Widget with a module loader you are still able to reference the Widget in the global scope by calling the "window.userlike" object.