mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
fix: Wait for fn to end before pushing next message
This commit is contained in:
parent
27b80739bc
commit
6fd67b68dd
@ -18,10 +18,10 @@ export const messages = [
|
|||||||
{ component: 'vText', data: 'End of demo 🎉' },
|
{ component: 'vText', data: 'End of demo 🎉' },
|
||||||
]
|
]
|
||||||
|
|
||||||
function streamMessages (fn, i = 0) {
|
async function streamMessages (fn, i = 0) {
|
||||||
if (i >= messages.length) return
|
if (i >= messages.length) return
|
||||||
fn(messages[i])
|
await fn(messages[i])
|
||||||
setTimeout(() => streamMessages(fn, i + 1), 2000)
|
setTimeout(() => streamMessages(fn, i + 1), 1500)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default streamMessages
|
export default streamMessages
|
Loading…
Reference in New Issue
Block a user