* Retrieves a value from tree context. * * Context is usually initialized at the root, but can be overridden at any point in the tree. * * @param key The context key * @returns The context value or `undefined` if there is no context value for this key.
(key: string)
| 274 | * @returns The context value or `undefined` if there is no context value for this key. |
| 275 | */ |
| 276 | public tryGetContext(key: string): any { |
| 277 | const value = this._context?.[key]; |
| 278 | if (value !== undefined) { return value; } |
| 279 | |
| 280 | return this.scope && this.scope.node.tryGetContext(key); |
| 281 | } |
| 282 | |
| 283 | /** |
| 284 | * An immutable array of metadata objects associated with this construct. |