Supervising controller pattern in Javascript