# 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>
