[code] implement event generator and listener