# Provider

**Kind**: interface | **Module**: [Search](https://docs.interop.io/desktop/reference/javascript/search/index.md)

**Source**: https://docs.interop.io/desktop/reference/javascript/search/provider/index.html

Describes a registered search provider.

## Properties

- **`appName`** (`string`, optional)
  Name of the app that has registered the search provider.
- **`id`** (`string`, required)
  Unique app ID within the framework.
- **`interopId`** (`string`, required)
  Unique ID of the Interop instance of the app.
- **`name`** (`string`, required)
  Name of the search provider.
- **`types`** (`SearchType[]`, optional)
  List of search types with which the search provider works.

## Methods

### onQuery

Notifies when a search query is received.

```ts
(callback: (query: ProviderQuery) => void) => UnsubscribeFunction
```

**Parameters**

- **`callback`** (`(query: ProviderQuery) => void`, required)
  Callback function for handling the event. Receives as an argument an object describing the search query.

**Returns**: `UnsubscribeFunction`

### onQueryCancel

Notifies when a search query is canceled.

```ts
(callback: (query: { id: string }) => void) => UnsubscribeFunction
```

**Parameters**

- **`callback`** (`(query: { id: string }) => void`, required)
  Callback function for handling the event. Receives as an argument an object with an `id` property
  holding the ID of the canceled search query.

**Returns**: `UnsubscribeFunction`

### unregister

Unregisters the search provider from the framework.

```ts
() => Promise<void>
```

**Returns**: `Promise<void>`

## Related types

- [ProviderQuery](https://docs.interop.io/desktop/reference/javascript/search/providerquery/index.md)
- [SearchType](https://docs.interop.io/desktop/reference/javascript/search/searchtype/index.md)
- [UnsubscribeFunction](https://docs.interop.io/desktop/reference/javascript/search/unsubscribefunction/index.md)
