---
title: PointsOfInterestSearchDelegate
framework: mapkitjs
role: symbol
role_heading: Type
path: mapkitjs/pointsofinterestsearchdelegate
---

# PointsOfInterestSearchDelegate

An object or callback function that MapKit JS calls when fetching points of interest.

## Declaration

```data
type PointsOfInterestSearchDelegate =
    | {
          searchDidError: (error: Error) => void;
          searchDidComplete: (result: PointsOfInterestSearchResponse) => void;
      }
    | ((
          error: Error | null,
          result: PointsOfInterestSearchResponse | null,
      ) => void);
```

## Discussion

Discussion You may pass an object to the search method instead of using of a search delegate callback function. MapKit JS calls the following methods on the delegate object when they exist: searchDidComplete – Upon successful completion of a search request, this method returns a data object that is the same as the one passed to the search callback function. searchDidError – Called when the search request fails.

## See Also

### Fetching points of interest

- [search(options)](mapkitjs/pointsofinterestsearch/search.md)
- [PointsOfInterestSearchResponse](mapkitjs/pointsofinterestsearchresponse.md)
