# ui.Map.onChangeCenter

<br />

Registers a callback that's fired when the map center changes. This is fired during pan or when the map's center is changed programmatically.

<br />

Returns an ID which can be passed to unlisten() to unregister the callback.

| Usage | Returns |
|---|---|
| `Map.onChangeCenter(callback)` | String |

| Argument | Type | Details |
|---|---|---|
| this: `ui.map` | ui.Map | The ui.Map instance. |
| `callback` | Function | The callback to fire when the map center changes. The callback is passed two parameters: an object containing the coordinates of the new center (with keys lon and lat) and the map widget itself. |