* Resolver for `@config.view` * @param ctx - Context object * @param injection - Injection metadata * @param session - Resolution session
( ctx: Context, injection: Injection, session: ResolutionSession, )
| 196 | * @param session - Resolution session |
| 197 | */ |
| 198 | function resolveAsViewFromConfig( |
| 199 | ctx: Context, |
| 200 | injection: Injection, |
| 201 | session: ResolutionSession, |
| 202 | ) { |
| 203 | assertTargetType(injection, ContextView); |
| 204 | const bindingKey = getTargetBindingKey(injection, session); |
| 205 | // Return `undefined` if no current binding is present |
| 206 | if (!bindingKey) return undefined; |
| 207 | const view = new ConfigView( |
| 208 | ctx, |
| 209 | binding => |
| 210 | binding.key === BindingKey.buildKeyForConfig(bindingKey).toString(), |
| 211 | injection.metadata.propertyPath, |
| 212 | ); |
| 213 | view.open(); |
| 214 | return view; |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * A subclass of `ContextView` to handle dynamic configuration as its |
nothing calls this directly
no test coverage detected