* 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)
| 290 | * @returns The context value or `undefined` if there is no context value for this key. |
| 291 | */ |
| 292 | public tryGetContext(key: string): any { |
| 293 | const value = this._context?.[key]; |
| 294 | if (value !== undefined) { return value; } |
| 295 | |
| 296 | return this.scope && this.scope.node.tryGetContext(key); |
| 297 | } |
| 298 | |
| 299 | /** |
| 300 | * An immutable array of metadata objects associated with this construct. |