# Event Basics

## Raising an Event

Providers can raise data events by creating an instance of the `wire.data.DataEvent` class, specifying the name of the event and then calling the `raise` method.

```javascript
new wire.data.DataEvent("myevent").raise();
```

## Listening for an Event

Consumers can listen for events by registering a listener as a function callback with the WireBootstrap Data Event Manager.  Use the `listen` method on `wire.data` to create a new listener.

```javascript
wire.data.listen().event("myevent").when((data) => {
   ...   
});
```

## Standard Events

Methods are available on `wire.data.DataEvent` class for creating standard data events in the system.

### DataSelect

The `dataselect`event is used primarily by WireBootstrap components to let other components know when a user selects or changes data inside the component. &#x20;

```javascript
const dataevent = new wire.data.DataEvent().dataselect();
```

### DataWrite

The `datawrite`event is used primarily by WireBootstrap components to let other components know a user has saved data to a data service.

```javascript
const dataevent = new wire.data.DataEvent().datawrite();
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wirebootstrap.com/wirebootstrap/data-events/listening-for-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
