import { functionMethod } from './functionMethod' ; type Method = ( name : string , value : any ) => ( ) => any ; type MethodWithDeferredValue = ( name : string , value : ( ) => any ) => ( ) => any ; export class Provider { private _method : Method ; private _isUsingDeprecatedProvideMethod : boolean ; private constructor ( ) { this . _isUsingDeprecatedProvideMethod = false ; } private static _instance : Provider ; public static get instance ( ) : Provider { this . _instance = this . _instance || new Provider ( ) ; return this . _instance ; } deprecated see see public provideMethod ( method ) { this . _isUsingDeprecatedProvideMethod = true ; this . _method = method ; } public provideMethodWithDeferredValue ( method ) { this . _method = method ; } public getMethod ( name , value ) { this . _method = this . _method || functionMethod ; if ( this . _isUsingDeprecatedProvideMethod ) { return this . _method ( name , value ( ) ) ; } return this . _method ( name , value ) ; } }