Life Ring Button

Description

This JS API provides you access to the new Life Ring Button tool. Access methods on this object:

productFruits.api.inAppCenter

Methods

open(opts)

Expands the Life Ring Button. It can receive an options object, see this example:

window.productFruits.api.inAppCenter.open({
	focus: { 
		articleId: 12345 // it will open the Life Ring Button focused to the particular article
	}
})

close()

Closes the Life Ring Button.

isOpened()

Returns true if the Life Ring Button is opened, false if it is not.

hide()

Hides the whole button widget - the launcher button and the popup.

show()

Shows the previously hidden button widget - the launcher button and the popup.

attachToCustomElement(elementInstance)

Attaches the Life Ring to a custom element in your application. It automatically hides the default launcher button. The argument must be an element instance, not a CSS selector.

If you call only this function, the built-in launcher can be displayed for a second under some circumstances. To prevent the built-in launcher from being visible completely, use hideInAppCenterLauncher configuration option set to true with the init script, as described here.

listen(event, callback)

Listens to a Life Ring Button event and calls the callback. Supported events are closed - this event is triggered when the Life Ring Button is closed; opened - triggered when the modal is opened.