javascript mediator