PLuG Javascript API

  • The PLuG widget exposes methods and callbacks which can be used to customize the widget behaviour further.
  • For eg: If you want a custom button, you can set hideFloatingToggleButton to true along with appropriate offset values, And then have your own button in your website call widget.open() and widget.close() methods directly.

Attributes:#

isReady: boolean

  • Returns true if all the widget Javascript files have been downloaded and the widget has been initialized successfully

Methods:#

open(): boolean

  • Open the widget
  • Returns true if widget was opened, false if widget was not ready

close(): boolean

  • Close the widget
  • Returns true if widget was closed, false if widget was not ready

destroy(): void

  • Completely removes the widget

reInitialize(config: DevRevSDKConfig, callbacks?: DevRevSDKCallbacks): void

  • Reinitialize the widget with new config and callbacks

Callbacks:#

onReady(callback: () => void)

  • Callback fired once the widget is ready

onOpen(callback: () => void)

  • Callback fired when the widget is opened

onClose(callback: () => void)

  • Callback fired when the widget is closed

Callback passed during initialization will be overwritten if the same callback is redefined using the above method#