Simple JavaScript class for managing events