Adding ctor function for every class exposed to js.