import Mediator from "./Mediator" ; export default class User { mediator : Mediator ; name : string ; constructor ( name , mediator ) { this . mediator = mediator ; this . name = name ; } public send ( message ) { this . mediator . send ( this , message ) ; } public receive ( sender , message ) { console . log ( `${ this . name } received message ${ message } from ${ sender . name }` ) ; } }