refactor util/event.js