# Events

_Mapbox-gl-path_ fires a number of events. All of these events are namespaced with `MapboxPathControl` and are emitted from the Mapbox GL JS map object. All events are all triggered by user interaction.

```js
map.on("MapboxPathControl.create", function (event) {
  console.log(event.createdPoint);
});
```

## MapboxPathControl.create

Fired when a Point is created.
The event data is an object with the following shape:

```typescript
{
  featureCollection: GeoJSON.FeatureCollection<GeoJSON.Geometry>,
  createdPoint: Feature<Point>
}
```

## MapboxPathControl.delete

Fired when a Point is deleted.
The event data is an object with the following shape:

```typescript
{
  deletedPoint: Feature<Point>
}
```

## MapboxPathControl.update

Fired when a Point is updated.
The event data is an object with the following shape:

```typescript
{
  featureCollection: GeoJSON.FeatureCollection<GeoJSON.Geometry>
}
```

## MapboxPathControl.loop

Fired when a Loop is activated.
The event data is an object with the following shape:

```typescript
{
  featureCollection: GeoJSON.FeatureCollection<GeoJSON.Geometry>
}
```

## MapboxPathControl.unLoop

Fired when a Loop is deactivated.
The event data is an object with the following shape:

```typescript
{
  featureCollection: GeoJSON.FeatureCollection<GeoJSON.Geometry>
}
```
