> For the complete documentation index, see [llms.txt](https://docs.videsk.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.videsk.io/es-developers/sdks/calendario/eventos.md).

# Eventos

Te explicamos cómo funcionan los eventos y qué hacer cuando estos son disparados.

## `days`

Este evento se dispara cuando se ha llamado al método `getDays`. El evento contiene los mismos valores de retorno que el método `getDays`.

```javascript
calendar.addEventListener('days', event => {
    const days = event.detail;
});
```

## `hours`

Este evento se dispara cuando se ha llamado al método `getHours`. El evento contiene los mismos valores de retorno que el método `getHours`.

```javascript
calendar.addEventListener('hours', event => {
    const hours = event.detail;
});
```

## `created`

Este evento se dispara cuando se ha llamado al método `create`. El evento contiene los mismos valores de retorno que el método `create`.

```javascript
calendar.addEventListener('created', event => {
    const response = event.detail;
});
```

## `canceled`

Este evento se dispara cuando se ha llamado al método `cancel`. El evento contiene los mismos valores de retorno que el método `cancel`.

```javascript
calendar.addEventListener('canceled', event => {
    const response = event.detail;
});
```

## `rescheduled`

Este evento se dispara cuando se ha llamado al método `reschedule`. El evento contiene los mismos valores de retorno que el método `reschedule`.

```javascript
calendar.addEventListener('rescheduled', event => {
    const response = event.detail;
});
```

## `join`

Este evento se dispara cuando se ha llamado al método `join`. El evento contiene el `accessToken` necesario para comenzar la videollamada.

{% hint style="info" %}
Con este evento deberás hacer uso de nuestro SDK de [WebRTC](https://docs.videsk.io/es-developers/sdks/webrtc.md#uso).
{% endhint %}

{% hint style="danger" %}
Recuerda que deberás escuchar el evento [hangup](https://docs.videsk.io/es-developers/sdks/webrtc/metodos.md#addeventlistener) de WebRTC para terminar el llamado, usando el método [destroy](https://docs.videsk.io/es-developers/sdks/webrtc/metodos.md#destroy). De lo contrario, la llamada seguirá activa.
{% endhint %}

```javascript
calendar.addEventListener('join', event => {
    const { accessToken } = event.detail;
    const webrtc = new WebRTC();
    await webrtc.create(accessToken);
});
```

{% content-ref url="/pages/-MbZ7VU4FhQ3OhWHFrJ2" %}
[WebRTC](https://docs.videsk.io/es-developers/sdks/webrtc.md)
{% endcontent-ref %}

## `modify`

Este evento se dispara cuando se ha llamado al método `modify`. El evento contiene la acción a realizar `action` y el token de aceso `accessToken`.

{% hint style="warning" %}
Es importante mantener siempre disponible `v-schedule-action` y `v-schedule-auth` en la URL, o bien las mismas keys pero en `localStorage`. De lo contrario no podremos detactar y emitir este evento.
{% endhint %}

```javascript
calendar.addEventListener('modify', event => {
    const { action, accessToken } = event;
});
```

En base a la acción, deberás mostrar la opción de cancelar o reagendar. La key `action` puede ser:

* `join`: Indica que se desea unir a la reunión
* `modify`: Indica que se desea modificar la cita

{% hint style="info" %}
Aquí deberás hacer uso del método `cancel` y `reschedule`.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.videsk.io/es-developers/sdks/calendario/eventos.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
