* Sets context data with the given name. * Data passed as context will be normalized. You can also pass `null` to unset the context. * Note that context data will not be merged - calling `setContext` will overwrite an existing context with the same key.
(key: string, context: Context | null)
| 455 | * Note that context data will not be merged - calling `setContext` will overwrite an existing context with the same key. |
| 456 | */ |
| 457 | public setContext(key: string, context: Context | null): this { |
| 458 | if (context === null) { |
| 459 | // eslint-disable-next-line @typescript-eslint/no-dynamic-delete |
| 460 | delete this._contexts[key]; |
| 461 | } else { |
| 462 | this._contexts[key] = context; |
| 463 | } |
| 464 | |
| 465 | this._notifyScopeListeners(); |
| 466 | return this; |
| 467 | } |
| 468 | |
| 469 | /** |
| 470 | * Set the session for the scope. |
no test coverage detected