# Events

All providers implements the `EventEmitter` API. This sections details the events emitted via that API. All the common `Event` which may take place in the `zkID Login` are listed as follow.

* [zkID\_Wallet\_didLoggedChanged(did\_changed)](#zkid_wallet_didloggedchanged-did_changed)
* [zkID\_Wallet\_lock(lock)](#zkid_wallet_lock-lock)
* [zkID\_Wallet\_unlock(unlock)](#zkid_wallet_unlock-unlock)

{% hint style="info" %}
*These events are triggered when the internal state of the zkID Wallet changes.*
{% endhint %}

## zkID\_Wallet\_didLoggedChanged(did\_changed)

### Usage

* When the DID selected in the zkID Wallet is changed, this event will be emitted.

You can use `provider.on` to catch this event. Here is an example of using our [Provider](https://github.com/zCloak-Network/zkid-login/blob/5f026f806867b44a68cb23e7efd0b34798d48ab1/packages/providers/src/ZkidWalletProvider.ts#L49) to listen to this event.

### Example

```typescript
provider.on('did_changed', (did) => {
  // Handle the new did when wallet selected did changed
  // `did` is an Object of `DidInfo`
})
```

## zkID\_Wallet\_lock(lock)

### Usage

* When the zkID Wallet is locked,  this event will be emitted.

You can use `provider.on` to catch this event. Here is an example of using our [Provider](https://github.com/zCloak-Network/zkid-login/blob/5f026f806867b44a68cb23e7efd0b34798d48ab1/packages/providers/src/ZkidWalletProvider.ts#L53) to listen to this event.

### Example

```typescript
provider.on('lock', (did) => {
  // Handle the wallet locked
})
```

## zkID\_Wallet\_unlock(unlock)

### Usage

* When the zkID Wallet is unlocked,  this event will be emitted.

You can use `provider.on` to catch this event. Here is an example of using our [Provider](https://github.com/zCloak-Network/zkid-login/blob/5f026f806867b44a68cb23e7efd0b34798d48ab1/packages/providers/src/ZkidWalletProvider.ts#L57) to listen to this event.

### Example

<pre class="language-typescript"><code class="lang-typescript"><strong>provider.on('unlock', (did) => {
</strong>  // Handle the wallet unlock
})
</code></pre>


---

# 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.zkid.app/api/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.
