add fn generate event