JavaScript class inherit to add an events management