Page Contents
Home > @loopback/context > DynamicValueProviderClass
DynamicValueProviderClass interface
A class with a static value method as the factory function for toDynamicValue.
Signature:
export interface DynamicValueProviderClass<T = unknown> extends Constructor<unknown>, Function
Extends: Constructor<unknown>, Function
Example
import {inject} from '@loopback/context';
export class DynamicGreetingProvider {
static value(@inject('currentUser') user: string) {
return `Hello, ${user}`;
}
}
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| [value](/doc/en/lb4/apidocs.context.dynamicvalueproviderclass.value.html) | (...args: [BoundValue](/doc/en/lb4/apidocs.context.boundvalue.html)\[\]) => [ValueOrPromise](/doc/en/lb4/apidocs.context.valueorpromise.html)<T> |