yield setimeout code example
Example: setimteout use function generator
function showValue() {
return setTimeout(function() {
function* gen() {
console.log('yielding');
yield 100;
};
var it = gen();
console.log(it.next().value);
}, 1000);
}
showValue();
console.log(showValue());