added EventDispatcher#when method