JavaScript event mediator / communication middle-man