optimize ES6 generator callback structure.