namespace formgen.ioc { /** */ export class trait_notification { /** */ private handlers : Array>; /** */ public constructor( handlers : Array> ) { this.handlers = handlers; } /** */ public listen( handler : type_handler ) : void { this.handlers.push(handler); } /** */ public async notify( value : type_value ) : Promise { return ( Promise.all( this.handlers.map( handler => handler(value) ) ) .then( () => Promise.resolve(undefined) ) ); } } }