UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

81 lines (44 loc) 1.59 kB
--- lang: en title: 'API docs: context.dynamicvalueproviderclass' keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI sidebar: lb4_sidebar editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/context permalink: /doc/en/lb4/apidocs.context.dynamicvalueproviderclass.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [DynamicValueProviderClass](./context.dynamicvalueproviderclass.md) ## DynamicValueProviderClass interface A class with a static `value` method as the factory function for `toDynamicValue`<!-- -->. **Signature:** ```typescript export interface DynamicValueProviderClass<T = unknown> extends Constructor<unknown>, Function ``` **Extends:** [Constructor](./context.constructor.md)<!-- -->&lt;unknown&gt;, Function ## Example ```ts import {inject} from '@loopback/context'; export class DynamicGreetingProvider { static value(@inject('currentUser') user: string) { return `Hello, ${user}`; } } ``` ## Properties <table><thead><tr><th> Property </th><th> Modifiers </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td markdown="1"> [value](./context.dynamicvalueproviderclass.value.md) </td><td markdown="1"> </td><td markdown="1"> (...args: [BoundValue](./context.boundvalue.md)<!-- -->\[\]) =&gt; [ValueOrPromise](./context.valueorpromise.md)<!-- -->&lt;T&gt; </td><td markdown="1"> </td></tr> </tbody></table>