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   (…args: BoundValue[]) => ValueOrPromise<T>