---
url: https://lit-ui-router.dev/reference/lit-ui-router/core/ContextRequestEvent.md
---
[lit-ui-router](../index.md) / ContextRequestEvent

# Class: ContextRequestEvent\<T>

Defined in: [packages/lit-ui-router/src/context.ts:130](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router/src/context.ts#L130)

A `context-request` event for any key: bubbling, composed and shaped as the
protocol specifies, so any provider answers it.

## Extends

* `Event`

## Extended by

* [`RouterContextRequestEvent`](RouterContextRequestEvent.md)

## Type Parameters

| Type Parameter | Description |
| ------ | ------ |
|  `T` *extends* [`UnknownContext`](../types/UnknownContext.md) | the context key's type, branded with the value it references |

## Implements

* [`ContextRequest`](../types/ContextRequest.md)<`T`>

## Constructors

### Constructor

```ts
new ContextRequestEvent<T>(
   context, 
   callback, 
   subscribe?
): ContextRequestEvent<T>;
```

Defined in: [packages/lit-ui-router/src/context.ts:146](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router/src/context.ts#L146)

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `context` | `T` | the context key to request |
| `callback` | [`ContextCallback`](../types/ContextCallback.md)<[`ContextType`](../types/ContextType.md)<`T`>> | receives the value from whichever provider answers |
| `subscribe?` | `boolean` | ask the provider to call back as the value changes |

#### Returns

`ContextRequestEvent`<`T`>

#### Overrides

`Event.constructor`

## Properties

| Property | Modifier | Type | Description | Defined in |
| ------ | ------ | ------ | ------ | ------ |
|  `callback` | `readonly` | [`ContextCallback`](../types/ContextCallback.md)<[`ContextType`](../types/ContextType.md)<`T`>> | Called by the provider with the value. | [packages/lit-ui-router/src/context.ts:137](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router/src/context.ts#L137) |
|  `context` | `readonly` | `T` | The key this request is for, matched by identity. | [packages/lit-ui-router/src/context.ts:135](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router/src/context.ts#L135) |
|  `subscribe?` | `readonly` | `boolean` | Whether later values are wanted. | [packages/lit-ui-router/src/context.ts:139](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router/src/context.ts#L139) |
