Closing or Hiding the Plugin

Closing the Plugin

The close() method can be used to force the closing of the plugin window. All requests to server and callback functions (except on_close) within the current session will be aborted.

An example of usage:

var session_id = 123;

OzLiveness.open({
  // We transfer the arbitrary meta data, by which we can later identify the session in Oz API
  meta: {
    session_id: session_id 
  },
  // After sending the data, forcibly close the plugin window and independently request the result
  on_submit: function() {
    OzLiveness.close();
    my_result_function(session_id);
  }
});

Hiding the Plugin Window without Cancelling the Callbacks

The hide() method can be used to hide the plugin window without cancelling the requests for analysis results and user callback functions. Use this method, for instance, if you want to output your own upload indicator after submitting data.

An example of usage:

OzLiveness.open({
  // When receiving an intermediate result, hide the plugin window and show our own loading indicators
  on_result: function(result) {
    OzLiveness.hide();
    if (result.state === 'processing') {
      show_my_loader();
    }
  },
  on_complete: function() {
    hide_my_loader();
  }
});

Last updated