# Event Hooks

You can implement various event hooks from within your component file to respond to certain events that take place during the lifecycle of your integration.

### onDetailsOpened

This hook fires after the details block has opened and the DOM for the details block has finished loading.  This hook will fire multiple times if the user opens and closes the details block.

{% code title="components/component.js" %}

```javascript
polarity.export = PolarityComponent.extend({
   onDetailsOpened: function(){
      // executed after the user has expanded the details block and the
      // DOM is fully loaded. 
   }         
});
```

{% endcode %}

### onDetailsClosed

This hook fires after the details block is closed by the user.  This hook can fire multiple times if the user opens and closes the details hook.

{% code title="components/component.js" %}

```javascript
polarity.export = PolarityComponent.extend({
   onDetailsClosed: function(){
      // executed after the user has closed the details block
   }         
});
```

{% endcode %}

### onDetailsComplete

This hook fires when the details block has fully loaded its data including and data that might be fetched from the `onDetails` hook on the server.  Unlike the `onDetailsOpened` hook, the `onDetailsComplete` hook will only fire once after the details data is loaded. &#x20;

{% code title="components/component.js" %}

```javascript
polarity.export = PolarityComponent.extend({
   onDetailsComplete: function(){
      // executed after the details block has fully loaded its data including
      // data fetched by a server side `onDetails` implementation.
   }         
});
```

{% endcode %}

### onDetailsError

This hook fires if there was an error loading the details (i.e., the `onDetails` hook on the server returned an error). &#x20;

{% code title="components/component.js" %}

```javascript
polarity.export = PolarityComponent.extend({
   onDetailsError: function(error){
      // executed if the `onDetails` 
   }         
});
```

{% endcode %}
