import { Binding , Context , inject , Provider } from '@loopback/core' ; import { logContexts } from '../util' ; export class Counter { constructor ( public readonly scope , public value ) { } inc ( ) { this . value ++ ; } } /**
 * A counter implementation
 */ export class CounterProvider implements Provider < Counter > { private readonly counter : Counter ; constructor ( @ inject . context ( ) resolutionCtx , @ inject . binding ( ) private binding ) { logContexts ( resolutionCtx , binding ) ; this . counter = new Counter ( `${ this . binding . key }@${ this . binding . scope }` , 0 ) ; } value ( ) { return this . counter ; } }