davidedc/livecodelab — pull request #207 by noio (2013-11-28 16:12:35+00:00)
Title: Refactor EventRouter

In reference to the discussion in #206: this is a first step, the eventRouter instance is still separate, whether that should be merged is another question. The changes in this pull request only replace the EventRouter by a generic EventEmitter base class that other parts of LCL (e.g. TimeKeeper) can extend.

The new EventEmitter no longer has a separate `context` argument for when listeners are added, because I could easily avoid the need for it using anonymous functions and `=>` in the few places where it was used at all.

I don't feel very strongly about merging the eventRouter into the LiveCodeLabCore ("step 2"). It might be more consistent: if different parts of LCL are EventEmitters, does it still make sense that the core "has a" eventEmitter in stead of "is a"?