# Closing or Hiding the Plugin

## Closing the Plugin

To force the closing of the plugin window, use the `close()` method.  All requests to server and callback functions (except `on_close`) within the current session will be aborted.

Example:

```javascript
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

To hide the plugin window without cancelling the requests for analysis results and user callback functions, call the `hide()` method. Use this method, for instance, if you want to display your own upload indicator after submitting data.

An example of usage:

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