Advanced settings
_imboxSettings
Declare this global object before instantiating the widget.
disableHistoryHooks
The widget is overriding the history hooks API by default to be able to reset the widget on page changes. The original functions will be called after our logic.
Usage
_imboxSettings = {
disableHistoryHooks: true
}
manualTrigger
The default behaviour of the widget is to start polling our backend right away to figure our what to show in the widget etc.
If you rather want to start the widget later on set manualTrigger
to true
. And then use the Advanced APIs below to start polling.
Usage
_imboxSettings = {
manualTrigger: true
}
Advanced widget APIs
The following APIs is for some special use cases.
reset
Resets the widget, which means clears all internal state and behaves as if the page is reloaded.
Usage
_imbox.push(["reset"])
start
If the widget is initialized with manualTrigger
set to true
you use this API to manually start the widget. The second parameter is optional.
Usage
_imbox.push(["start", { showLauncher: true | false }])
refreshGlobalSettings
Refreshes the Widget global settings, this is to make sure the widget is using the correct version for triggers. The second parameter is optional.
Usage
_imbox.push(["refreshGlobalSettings", callback])
changeSid
For some use cases you might want to change the sid while the widget is running, this is usally combined with other APIs, see example below.
Usage
_imbox.push(["changeSid", "sid"])
Example
// This is defined somewhere else, where the widget is initialized:
_imboxSettings = {
manualTrigger: true,
disableHistoryHooks: true
}
// ...
_imbox.push(["reset"])
_imbox.push([
"changeSid",
"OTHER_IMBOX_ID_HERE",
function () {
// Do something once completed
}
])