I would really try to move event dispatching to cpp side. Can listeners be stored on cpp side as js callbacks? Than we would not need it all this magic above. Do you think it is possible? (or Could you please elaborate why it is impossible?)