Saber Feedback Documentation

Javascript API

Saber’s Javascript API allows you to interact with and control Saber through the global window.Saber object.


open

The open method opens the Saber feedback interface in exactly the same way as when the feedback button is clicked. If the feedback interface is already open nothing will happen. If you have specified an `on_open` event handler, this will be triggered. There are no arguments passed to the open method.

Example:

Saber.do('open');

close

The close method closes the Saber feedback interface in exactly the same way as when the feedback interface is cancelled. If the feedback interface is not currently open nothing will happen. If you have specified an `on_close` event handler, this will be triggered. There are no arguments passed to the close method.

Example:

Saber.do('close');

set_options

The set_options method allows you to set runtime options after Saber has been loaded. The options should be passed as a hash object to the `set_options` method.

Example:

Saber.do('set_options', {
  language: 'fr', // set the language to French
  feedback_values: {
    _email: 'matt@saberfeedback.com' // set default value for email field
  }
});

set_option

The set_option method is a convenience method that allows you to set a single run time option. `set_option` requires two arguments, the option name, and its new value.

Example:

Saber.do('set_option', 'languge', 'fr'); // set the language to French