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 being 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.
The Chat Widget is using a single global object to handle JSONP callbacks. So please do not overwrite the userlike-object in the global scope!

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.