Event library with bubling feature written in TypeScript