* 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)
| 303 | * @returns The context value or `undefined` if there is no context value for this key. |
| 304 | */ |
| 305 | public tryGetContext(key: string): any { |
| 306 | const value = this._context?.[key]; |
| 307 | if (value !== undefined) { return value; } |
| 308 | |
| 309 | return this.scope && this.scope.node.tryGetContext(key); |
| 310 | } |
| 311 | |
| 312 | /** |
| 313 | * An immutable array of metadata objects associated with this construct. |