while(true) 的应用

Tags
javascript
Created
Jan 30, 2018 2:34 AM

function* watchAndLog(getState) {

while(true) {

const action = yield take('*')

console.log('action', action)

console.log('state after', getState())

})

}

fn = async () => {

while (true) {

await new Promise(res => setTimeout(res, 1000))

console.log(1)

}

}

SuperMade with Super